Use explicit cross-platform flock rather than impurely referencing it #30
1 changed files with 4 additions and 3 deletions
|
@ -31,6 +31,7 @@
|
||||||
nix = "${getExe final.nix}";
|
nix = "${getExe final.nix}";
|
||||||
nixos-rebuild = "${getExe final.nixos-rebuild}";
|
nixos-rebuild = "${getExe final.nixos-rebuild}";
|
||||||
openssh = "${getExe final.openssh}";
|
openssh = "${getExe final.openssh}";
|
||||||
|
flock = "${getExe final.flock}";
|
||||||
|
|
||||||
n = flake.nixosConfigurations.${machine}._module.args.nixinate;
|
n = flake.nixosConfigurations.${machine}._module.args.nixinate;
|
||||||
hermetic = n.hermetic or false;
|
hermetic = n.hermetic or false;
|
||||||
|
@ -54,14 +55,14 @@
|
||||||
'' + (if hermetic then ''
|
'' + (if hermetic then ''
|
||||||
echo "🤞 Activating configuration hermetically on ${machine} via ssh:"
|
echo "🤞 Activating configuration hermetically on ${machine} via ssh:"
|
||||||
( set -x; ${nix} ${nixOptions} copy --derivation ${nixos-rebuild} --to ssh://${user}@${host} )
|
( set -x; ${nix} ${nixOptions} copy --derivation ${nixos-rebuild} --to ssh://${user}@${host} )
|
||||||
( set -x; ${openssh} -t ${user}@${host} "sudo flock -w 60 /dev/shm/nixinate-${machine} -c 'nix-store --realise ${nixos-rebuild} && sudo ${nixos-rebuild} ${nixOptions} ${switch} --flake ${flake}#${machine}'" )
|
( set -x; ${openssh} -t ${user}@${host} "sudo ${flock} -w 60 /dev/shm/nixinate-${machine} nix-store --realise ${nixos-rebuild} && sudo ${nixos-rebuild} ${nixOptions} ${switch} --flake ${flake}#${machine}" )
|
||||||
'' else ''
|
'' else ''
|
||||||
echo "🤞 Activating configuration non-hermetically on ${machine} via ssh:"
|
echo "🤞 Activating configuration non-hermetically on ${machine} via ssh:"
|
||||||
( set -x; ${openssh} -t ${user}@${host} "sudo flock -w 60 /dev/shm/nixinate-${machine} -c 'nixos-rebuild ${switch} --flake ${flake}#${machine}'" )
|
( set -x; ${openssh} -t ${user}@${host} "sudo ${flock} -w 60 /dev/shm/nixinate-${machine} nixos-rebuild ${switch} --flake ${flake}#${machine}" )
|
||||||
'')
|
'')
|
||||||
else ''
|
else ''
|
||||||
echo "🔨 Building system closure locally, copying it to remote store and activating it:"
|
echo "🔨 Building system closure locally, copying it to remote store and activating it:"
|
||||||
( set -x; NIX_SSHOPTS="-t" flock -w 60 /dev/shm/nixinate-${machine} -c '${nixos-rebuild} ${nixOptions} ${switch} --flake ${flake}#${machine} --target-host ${user}@${host} --use-remote-sudo ${optionalString substituteOnTarget "-s"}' )
|
( set -x; NIX_SSHOPTS="-t" ${flock} -w 60 /dev/shm/nixinate-${machine} ${nixos-rebuild} ${nixOptions} ${switch} --flake ${flake}#${machine} --target-host ${user}@${host} --use-remote-sudo ${optionalString substituteOnTarget "-s"} )
|
||||||
|
|
||||||
'');
|
'');
|
||||||
in final.writeScript "deploy-${machine}.sh" script;
|
in final.writeScript "deploy-${machine}.sh" script;
|
||||||
|
|
Loading…
Add table
Reference in a new issue