commit e383f1b3d33c6ada3e14fd7c063d15bf57494c95
parent da1245432e157d8a16915c1f9b71e873f97e3ad8
Author: Daniel Barlow <dan@telent.net>
Date: Thu, 10 Oct 2024 16:25:00 +0100
obfuscate store path for min-copy-closure
otherwise the systemconfig closure drags in a bunch of build system
things (bash, etc) which we don't want or need to copy to the device
Diffstat:
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/pkgs/systemconfig/build-system-install.sh b/pkgs/systemconfig/build-system-install.sh
@@ -9,7 +9,9 @@ die() {
exit 1
}
-PATH=@min-copy-closure@/bin:$PATH
+# add min-copy-closure to the path. removing junk characters
+# inserted by default.nix (q.v.)
+min_copy_closure=@min-copy-closure@; PATH=${min_copy_closure//_/}/bin:$PATH
ssh_command=${SSH_COMMAND-ssh}
@@ -37,6 +39,7 @@ test -e $toplevel/etc/nix-store-paths || die "missing etc/nix-store-paths, is th
echo installing from systemConfiguration $toplevel to host $target_host
min-copy-closure $target_host $toplevel
+set -x
$ssh_command $target_host $toplevel/bin/install
case "$reboot" in
reboot)
diff --git a/pkgs/systemconfig/default.nix b/pkgs/systemconfig/default.nix
@@ -83,7 +83,10 @@ in attrset:
$STRIP --remove-section=.note --remove-section=.comment --strip-all makedevs -o $out/bin/activate
ln -s ${s6-init-bin}/bin/init $out/bin/init
cp -p ${writeFennel "restart-services" {} ./restart-services.fnl} $out/bin/restart-services
- substitute ${./build-system-install.sh} $out/install.sh --subst-var-by min-copy-closure ${buildPackages.min-copy-closure}
+ # obfuscate the store path of min-copy-closure so that the output
+ # closure doesn't include a bunch of build system stuff
+ f=${buildPackages.min-copy-closure}; f=$(echo $f | sed 's/\(.....\)/\1_/g')
+ substitute ${./build-system-install.sh} $out/install.sh --subst-var-by min-copy-closure $f
chmod +x $out/install.sh
cat > $out/bin/install <<EOF
#!/bin/sh -e