on cc47fa3 help sign in
appdir.nix+2−2
since splitsnapshots
unifiedsplit
@@ -1,4 +1,4 @@
1−{ stdenv, lib, fetchurl, muslPkgs, perl, pathsFromGraph, fetchFromGitHub, coreutils, bash }:
1+{ stdenv, fetchurl, muslPkgs, perl, pathsFromGraph, fetchFromGitHub, coreutils, bash }:
2
2
3let
3let
4 AppRun = targets: muslPkgs.stdenv.mkDerivation {
4 AppRun = targets: muslPkgs.stdenv.mkDerivation {
@@ -8,7 +8,7 @@ let
8
8
9 buildPhase = ''
9 buildPhase = ''
10 CC="$CC -O2 -Wall -Wno-deprecated-declarations -Wno-unused-result -static"
10 CC="$CC -O2 -Wall -Wno-deprecated-declarations -Wno-unused-result -static"
11− $CC ${./AppRun.c} -o AppRun -DENV_PATH='"${lib.makeBinPath targets}"'
11+ $CC ${./AppRun.c} -o AppRun -DENV_PATH='"${stdenv.lib.makeBinPath targets}"'
12 '';
12 '';
13
13
14 installPhase = ''
14 installPhase = ''
appimagetool.nix+2−2
@@ -1,4 +1,4 @@
1−{ stdenv, lib, fetchurl, fuse, zlib, squashfsTools, glib }:
1+{ stdenv, fetchurl, fuse, zlib, squashfsTools, glib }:
2
2
3# This is from some binaries.
3# This is from some binaries.
4
4
@@ -37,7 +37,7 @@ in stdenv.mkDerivation rec {
37 for x in $out/bin/*; do
37 for x in $out/bin/*; do
38 patchelf \
38 patchelf \
39 --set-interpreter ${dynamicLinker} \
39 --set-interpreter ${dynamicLinker} \
40− --set-rpath ${lib.makeLibraryPath [ zlib stdenv.glibc.out fuse glib ]} \
40+ --set-rpath ${stdenv.lib.makeLibraryPath [ zlib stdenv.glibc.out fuse glib ]} \
41 $x
41 $x
42 done
42 done
43 '';
43 '';
default.nix+8−23
@@ -10,16 +10,6 @@ let
10 '';
10 '';
11 });
11 });
12in rec {
12in rec {
13− toStorePath = target:
14− # If a store path has been given but is not a derivation, add the missing context
15− # to it so it will be propagated properly as a build input.
16− if !(lib.isDerivation target) && 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−
23 arx = { archive, startup}:
13 arx = { archive, startup}:
24 stdenv.mkDerivation {
14 stdenv.mkDerivation {
25 name = "arx";
15 name = "arx";
@@ -45,7 +35,7 @@ in rec {
45 };
35 };
46
36
47 # TODO: eventually should this go in nixpkgs?
37 # TODO: eventually should this go in nixpkgs?
48− nix-user-chroot = lib.makeOverridable stdenv.mkDerivation {
38+ nix-user-chroot = stdenv.lib.makeOverridable stdenv.mkDerivation {
49 name = "nix-user-chroot-2c52b5f";
39 name = "nix-user-chroot-2c52b5f";
50 src = ./nix-user-chroot;
40 src = ./nix-user-chroot;
51
41
@@ -80,20 +70,15 @@ in rec {
80 };
70 };
81 };
71 };
82
72
83− makeStartup = { target, nixUserChrootFlags, nix-user-chroot', run, initScript }:
73+ 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
88 writeScript "startup" ''
74 writeScript "startup" ''
89 #!/bin/sh
75 #!/bin/sh
90− ${initScript}
91− .${nix-user-chroot'}/bin/nix-user-chroot -n ./nix ${nixUserChrootFlags} -- ${path}${run} "$@"
76+ .${nix-user-chroot'}/bin/nix-user-chroot -n ./nix ${nixUserChrootFlags} -- ${target}${run} "$@"
92 '';
77 '';
93
78
94− nix-bootstrap = { target, extraTargets ? [], run, nix-user-chroot' ? nix-user-chroot, nixUserChrootFlags ? "", initScript ? "" }:
79+ nix-bootstrap = { target, extraTargets ? [], run, nix-user-chroot' ? nix-user-chroot, nixUserChrootFlags ? "" }:
95 let
80 let
96− script = makeStartup { inherit target nixUserChrootFlags nix-user-chroot' run initScript; };
81+ script = makeStartup { inherit target nixUserChrootFlags nix-user-chroot' run; };
97 in makebootstrap {
82 in makebootstrap {
98 startup = ".${script} '\"$@\"'";
83 startup = ".${script} '\"$@\"'";
99 targets = [ "${script}" ] ++ extraTargets;
84 targets = [ "${script}" ] ++ extraTargets;
@@ -110,10 +95,10 @@ in rec {
110 nix-user-chroot'' = targets: nix-user-chroot.overrideDerivation (o: {
95 nix-user-chroot'' = targets: nix-user-chroot.overrideDerivation (o: {
111 buildInputs = o.buildInputs ++ targets;
96 buildInputs = o.buildInputs ++ targets;
112 makeFlags = o.makeFlags ++ [
97 makeFlags = o.makeFlags ++ [
113− ''ENV_PATH="${lib.makeBinPath targets}"''
98+ ''ENV_PATH="${stdenv.lib.makeBinPath targets}"''
114 ];
99 ];
115− }); in { target, extraTargets ? [], run, initScript ? "" }: nix-bootstrap {
100+ }); in { target, extraTargets ? [], run }: nix-bootstrap {
116− inherit target extraTargets run initScript;
101+ inherit target extraTargets run;
117 nix-user-chroot' = nix-user-chroot'' extraTargets;
102 nix-user-chroot' = nix-user-chroot'' extraTargets;
118 };
103 };
119}
104}
flake.nix+1−1
@@ -13,7 +13,7 @@
13 nix-bundle = import self { nixpkgs = nixpkgs'; };
13 nix-bundle = import self { nixpkgs = nixpkgs'; };
14 script = nixpkgs'.writeScript "startup" ''
14 script = nixpkgs'.writeScript "startup" ''
15 #!/bin/sh
15 #!/bin/sh
16− .${nix-bundle.nix-user-chroot}/bin/nix-user-chroot -n ./nix -- ${program} "$@"
16+ .${nix-bundle.nix-user-chroot}/bin/nix-user-chroot -n ./nix -- ${program} $@
17 '';
17 '';
18 in nix-bundle.makebootstrap {
18 in nix-bundle.makebootstrap {
19 targets = [ script ];
19 targets = [ script ];
nix-bundle.sh+1−4
@@ -8,9 +8,6 @@ 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−
14For example:
11For example:
15
12
16$ $0 hello /bin/hello
13$ $0 hello /bin/hello
@@ -59,5 +56,5 @@ elif [ -t 1 ]; then
59 echo "Nix bundle created at $filename."
56 echo "Nix bundle created at $filename."
60 cp -f "$out" "$filename"
57 cp -f "$out" "$filename"
61else
58else
62− echo "$out"
59+ cat "$out"
63fi
60fi
test.shdeleted−10
@@ -1,10 +0,0 @@
1−#!/usr/bin/env bash
2−set -euo pipefail
3−export NIX_PATH=channel:nixos-20.09
4−
5−echo "Test with attribute name"
6−./nix-bundle.sh hello /bin/hello
7−
8−echo "Test with store path"
9−out=$(nix-build --no-out-link --expr '(import <nixpkgs> {})' -A hello)
10−./nix-bundle.sh "$out" /bin/hello