mirror of
https://github.com/NixOS/nix
synced 2025-07-08 02:43:54 +02:00
nix: Add --expr flag
This replaces the '(...)' installable syntax, which is not very discoverable. The downside is that you can't have multiple expressions or mix expressions and other installables.
This commit is contained in:
parent
2c6dbcd5e7
commit
ca8caaec5e
9 changed files with 86 additions and 76 deletions
|
@ -2,17 +2,17 @@ source common.sh
|
|||
|
||||
clearStore
|
||||
|
||||
nix eval '(assert 1 + 2 == 3; true)'
|
||||
nix eval --expr 'assert 1 + 2 == 3; true'
|
||||
|
||||
[[ $(nix eval --impure '(builtins.readFile ./pure-eval.sh)') =~ clearStore ]]
|
||||
[[ $(nix eval --impure --expr 'builtins.readFile ./pure-eval.sh') =~ clearStore ]]
|
||||
|
||||
(! nix eval '(builtins.readFile ./pure-eval.sh)')
|
||||
(! nix eval --expr 'builtins.readFile ./pure-eval.sh')
|
||||
|
||||
(! nix eval '(builtins.currentTime)')
|
||||
(! nix eval '(builtins.currentSystem)')
|
||||
(! nix eval --expr builtins.currentTime)
|
||||
(! nix eval --expr builtins.currentSystem)
|
||||
|
||||
(! nix-instantiate --pure-eval ./simple.nix)
|
||||
|
||||
[[ $(nix eval --impure "((import (builtins.fetchurl { url = file://$(pwd)/pure-eval.nix; })).x)") == 123 ]]
|
||||
(! nix eval "((import (builtins.fetchurl { url = file://$(pwd)/pure-eval.nix; })).x)")
|
||||
nix eval "((import (builtins.fetchurl { url = file://$(pwd)/pure-eval.nix; sha256 = \"$(nix hash-file pure-eval.nix --type sha256)\"; })).x)"
|
||||
[[ $(nix eval --impure --expr "(import (builtins.fetchurl { url = file://$(pwd)/pure-eval.nix; })).x") == 123 ]]
|
||||
(! nix eval --expr "(import (builtins.fetchurl { url = file://$(pwd)/pure-eval.nix; })).x")
|
||||
nix eval --expr "(import (builtins.fetchurl { url = file://$(pwd)/pure-eval.nix; sha256 = \"$(nix hash-file pure-eval.nix --type sha256)\"; })).x"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue