on master help sign in
support store paths
cb765adzimbatm
default.nix+15−1
@@ -10,6 +10,16 @@ let
10 '';
10 '';
11 });
11 });
12in rec {
12in rec {
13+ toStorePath = target:
14+ # If a store path has been given, transform it to a string. And make sure
15+ # to capture the store path in its context.
16+ if lib.isStorePath target then
17+ let path = toString target; in
18+ builtins.appendContext path { "${path}" = { path = true; }; }
19+ # Otherwise, add to the store. This takes care of appending the store path
20+ # in the context automatically.
21+ else "${target}";
22+
13 arx = { archive, startup}:
23 arx = { archive, startup}:
14 stdenv.mkDerivation {
24 stdenv.mkDerivation {
15 name = "arx";
25 name = "arx";
@@ -71,9 +81,13 @@ in rec {
71 };
81 };
72
82
73 makeStartup = { target, nixUserChrootFlags, nix-user-chroot', run }:
83 makeStartup = { target, nixUserChrootFlags, nix-user-chroot', run }:
84+ let
85+ # Avoid re-adding a store path into the store
86+ path = toStorePath target;
87+ in
74 writeScript "startup" ''
88 writeScript "startup" ''
75 #!/bin/sh
89 #!/bin/sh
76− .${nix-user-chroot'}/bin/nix-user-chroot -n ./nix ${nixUserChrootFlags} -- ${target}${run} "$@"
90+ .${nix-user-chroot'}/bin/nix-user-chroot -n ./nix ${nixUserChrootFlags} -- ${path}${run} "$@"
77 '';
91 '';
78
92
79 nix-bootstrap = { target, extraTargets ? [], run, nix-user-chroot' ? nix-user-chroot, nixUserChrootFlags ? "" }:
93 nix-bootstrap = { target, extraTargets ? [], run, nix-user-chroot' ? nix-user-chroot, nixUserChrootFlags ? "" }:
nix-bundle.sh+3
@@ -8,6 +8,9 @@ Usage: $0 TARGET EXECUTABLE
8Create a single-file bundle from the nixpkgs attribute "TARGET".
8Create a single-file bundle from the nixpkgs attribute "TARGET".
9EXECUTABLE should be relative to the TARGET's output path.
9EXECUTABLE should be relative to the TARGET's output path.
10
10
11+The TARGET is either an attribute in nixpkgs, or an absolute path to the
12+store.
13+
11For example:
14For example:
12
15
13$ $0 hello /bin/hello
16$ $0 hello /bin/hello