mirror of
https://github.com/ilyakooo0/nix-bundle.git
synced 2024-09-11 06:55:53 +03:00
commit
1ceecc645f
@ -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
10
test.sh
Executable 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
|
Loading…
Reference in New Issue
Block a user