mirror of
https://github.com/NixOS/nix
synced 2025-07-08 02:43:54 +02:00
Merge pull request #10122 from edolstra/arg-from-file
Add --arg-from-file and --arg-from-stdin
This commit is contained in:
commit
438855952b
4 changed files with 65 additions and 9 deletions
|
@ -41,3 +41,14 @@ mkdir -p $TEST_ROOT/xyzzy $TEST_ROOT/foo
|
|||
ln -sfn ../xyzzy $TEST_ROOT/foo/bar
|
||||
printf 123 > $TEST_ROOT/xyzzy/default.nix
|
||||
[[ $(nix eval --impure --expr "import $TEST_ROOT/foo/bar") = 123 ]]
|
||||
|
||||
# Test --arg-from-file.
|
||||
[[ "$(nix eval --raw --arg-from-file foo config.nix --expr '{ foo }: { inherit foo; }' foo)" = "$(cat config.nix)" ]]
|
||||
|
||||
# Check that special(-ish) files are drained.
|
||||
if [[ -e /proc/version ]]; then
|
||||
[[ "$(nix eval --raw --arg-from-file foo /proc/version --expr '{ foo }: { inherit foo; }' foo)" = "$(cat /proc/version)" ]]
|
||||
fi
|
||||
|
||||
# Test --arg-from-stdin.
|
||||
[[ "$(echo bla | nix eval --raw --arg-from-stdin foo --expr '{ foo }: { inherit foo; }' foo)" = bla ]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue