on master help sign in
Merge pull request #87 from takeda/init-script
e9fa7e8Matthew Bauer
default.nix+6−5
unifiedsplit
@@ -80,19 +80,20 @@ in rec {
80 };
80 };
81 };
81 };
82
82
83− makeStartup = { target, nixUserChrootFlags, nix-user-chroot', run }:
83+ makeStartup = { target, nixUserChrootFlags, nix-user-chroot', run, initScript }:
84 let
84 let
85 # Avoid re-adding a store path into the store
85 # Avoid re-adding a store path into the store
86 path = toStorePath target;
86 path = toStorePath target;
87 in
87 in
88 writeScript "startup" ''
88 writeScript "startup" ''
89 #!/bin/sh
89 #!/bin/sh
90+ ${initScript}
90 .${nix-user-chroot'}/bin/nix-user-chroot -n ./nix ${nixUserChrootFlags} -- ${path}${run} "$@"
91 .${nix-user-chroot'}/bin/nix-user-chroot -n ./nix ${nixUserChrootFlags} -- ${path}${run} "$@"
91 '';
92 '';
92
93
93− nix-bootstrap = { target, extraTargets ? [], run, nix-user-chroot' ? nix-user-chroot, nixUserChrootFlags ? "" }:
94+ nix-bootstrap = { target, extraTargets ? [], run, nix-user-chroot' ? nix-user-chroot, nixUserChrootFlags ? "", initScript ? "" }:
94 let
95 let
95− script = makeStartup { inherit target nixUserChrootFlags nix-user-chroot' run; };
96+ script = makeStartup { inherit target nixUserChrootFlags nix-user-chroot' run initScript; };
96 in makebootstrap {
97 in makebootstrap {
97 startup = ".${script} '\"$@\"'";
98 startup = ".${script} '\"$@\"'";
98 targets = [ "${script}" ] ++ extraTargets;
99 targets = [ "${script}" ] ++ extraTargets;
@@ -111,8 +112,8 @@ in rec {
111 makeFlags = o.makeFlags ++ [
112 makeFlags = o.makeFlags ++ [
112 ''ENV_PATH="${lib.makeBinPath targets}"''
113 ''ENV_PATH="${lib.makeBinPath targets}"''
113 ];
114 ];
114− }); in { target, extraTargets ? [], run }: nix-bootstrap {
115+ }); in { target, extraTargets ? [], run, initScript ? "" }: nix-bootstrap {
115− inherit target extraTargets run;
116+ inherit target extraTargets run initScript;
116 nix-user-chroot' = nix-user-chroot'' extraTargets;
117 nix-user-chroot' = nix-user-chroot'' extraTargets;
117 };
118 };
118}
119}