Merge pull request #70 from zimbatm/fixup

fixes #68
This commit is contained in:
Matthew Bauer 2020-12-02 17:03:36 -06:00 committed by GitHub
commit 1ceecc645f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View File

@ -11,11 +11,10 @@ let
});
in rec {
toStorePath = target:
# If a store path has been given, transform it to a string. And make sure
# to capture the store path in its context.
if lib.isStorePath target then
let path = toString target; in
builtins.appendContext path { "${path}" = { path = true; }; }
# If a store path has been given but is a string, add the missing context
# to it so it will be propagated properly as a build input.
if builtins.isString target && lib.isStorePath target then
builtins.appendContext target { "${target}" = { path = true; }; }
# Otherwise, add to the store. This takes care of appending the store path
# in the context automatically.
else "${target}";

10
test.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail
export NIX_PATH=channel:nixos-20.09
echo "Test with attribute name"
./nix-bundle.sh hello /bin/hello
echo "Test with store path"
out=$(nix-build --no-out-link --expr '(import <nixpkgs> {})' -A hello)
./nix-bundle.sh "$out" /bin/hello