在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):haskell-nix/hnix开源软件地址(OpenSource Url):https://github.com/haskell-nix/hnix开源编程语言(OpenSource Language):Nix 59.3%开源软件介绍(OpenSource Introduction):HNixParser, evaluator and type checker for the Nix language written in Haskell. PrerequisitesTooling is WIP, Disclaimer: Since still using Nix for some operations, current Building the projectGit clonegit clone --recursive 'https://github.com/haskell-nix/hnix.git' && cd hnix (optional) Cachix prebuild binary cachesIf you would use our Nix-shell environment for development, you can connect to our Cachix HNix build caches:
Building with CabalCabal Quickstart.
Checking the projectBenchmarksTo run benchmarks: cabal v2-bench ProfilingGHC User Manual has a full "Profiling" section of relevant info. To build cabal v2-run hnix --enable-profiling --flags=profiling -- <args> +RTS -p Or to put simply: # Run profiling for evaluation of a Firefox package.
# Generate:
# * for all functions
# * time profiling data
# * memory allocation profiling data
# * in the JSON profiling format
cabal v2-run --enable-profiling --flags=profiling --enable-library-profiling --profiling-detail='all-functions' hnix -- --eval --expr '(import <nixpkgs> {}).firefox.outPath' +RTS -Pj
# Then, upload the `hnix.prof` to the https://www.speedscope.app/ to analyze it. "RTS" stands for "RunTime System" and has a lot of options, GHC User Manual has "Running a compiled program"/"Setting RTS options" sections describing them. Full debug infoTo run stack traces & full tracing output on cabal v2-configure --enable-tests --enable-profiling --flags=profiling --flags=tracing
cabal v2-run hnix -- -v5 --trace <args> +RTS -xc This would give the most information as to what happens during parsing & evaluation. Runing executablecabal v2-run hnix -- --help ( Building with Nix-buildThere is a number of build options to use with Options can be used as: nix-build \
--arg <option1> <argument1> \
--arg <option2> <argument2> \
--argstr <option3> "<strinTypeArg>" Checking the projectBenchmarksnix-build \
--arg disableOptimization false \
--arg enableDeadCodeElimination true \
--arg doStrip true \
--arg doBenchmark true Profilingnix-build \
--arg disableOptimization false \
--arg enableDeadCodeElimination true \
--arg enableLibraryProfiling true \
--arg enableExecutableProfiling true
./result/bin/hnix <args> +RTS -p Full debug infonix-build \
--arg disableOptimization false \
--arg enableDeadCodeElimination true \
--arg doBenchmark true \
--arg doStrip false \
--arg enableLibraryProfiling true \
--arg enableExecutableProfiling true \
--arg doTracing true \
--arg enableDWARFDebugging true
./result/bin/hnix -v5 --trace <args> +RTS -xc Runing executable./result/bin/hnix Using HNixSee:
It has a pretty full/good description of the current options. Parse & printTo parse a file with hnix file.nix Evaluating and printing the resulting valueExpression from a file: hnix --eval file.nix Expression: hnix --eval --expr 'import <nixpkgs> {}' Evaluating NixpkgsCurrently, the main high-level goal is to be able to evaluate all of Nixpkgs: hnix --eval --expr "import <nixpkgs> {}" --find Options supported only by HNixTo see value provenance and thunk context: hnix -v2 --values --thunk --eval --expr 'import <nixpkgs> {}' To see tracing as the evaluator runs (note that building with hnix --trace --eval --expr 'import <nixpkgs> {}' To attempt to generate a reduced test case demonstrating an error: hnix --reduce bug.nix --eval --expr 'import <nixpkgs> {}' REPLTo enter REPL: hnix --repl Evaluate an expression and load it into REPL: hnix --eval --expr '(import <nixpkgs> {}).pkgs.hello' --repl This binds the evaluated expression result to the Use the Language lazinessNix is a lazy language with the ability of recursion, so by default REPL and eval prints are lazy: hnix \
--eval \
--expr '{ x = true; }'
{ x = "<expr>"; } To disable laziness add the hnix \
--eval \
--strict \
--expr '{ x = true; }'
{ x = true; } Contributing
(optional) Minimalistic development status loop with amazing |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论