Merge pull request #21 from MatthewCroughan/mc/hermetic-remote-fix

Fix hermetic remote builds and tests
This commit is contained in:
MatthewCroughan 2022-06-02 01:00:06 +01:00 committed by GitHub
commit 4d49f60a09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -30,6 +30,7 @@
inherit (final.lib) getExe; inherit (final.lib) getExe;
nix = "${getExe final.nix}"; nix = "${getExe final.nix}";
nixos-rebuild = "${getExe final.nixos-rebuild}"; nixos-rebuild = "${getExe final.nixos-rebuild}";
nixos-rebuild-drvPath = final.nixos-rebuild.drvPath;
openssh = "${getExe final.openssh}"; openssh = "${getExe final.openssh}";
n = flake.nixosConfigurations.${machine}._module.args.nixinate; n = flake.nixosConfigurations.${machine}._module.args.nixinate;
@ -50,8 +51,8 @@
( set -x; ${nix} copy ${flake} --to ssh://${user}@${host} ) ( set -x; ${nix} copy ${flake} --to ssh://${user}@${host} )
'' + (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} build ${nixos-rebuild} --no-link --store ssh://${user}@${host} ) ( set -x; ${nix} copy --derivation ${nixos-rebuild} --to ssh://${user}@${host} )
( set -x; ${openssh} -t ${user}@${host} 'sudo ${nixos-rebuild} ${switch} --flake ${flake}#${machine}' ) ( set -x; ${openssh} -t ${user}@${host} 'sudo nix-store --realise ${nixos-rebuild-drvPath} && sudo ${nixos-rebuild} ${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 nixos-rebuild ${switch} --flake ${flake}#${machine}' ) ( set -x; ${openssh} -t ${user}@${host} 'sudo nixos-rebuild ${switch} --flake ${flake}#${machine}' )

View file

@ -2,4 +2,6 @@
{ {
vmTestLocal = (import ./vmTest { inherit pkgs makeTest inputs; }).local; vmTestLocal = (import ./vmTest { inherit pkgs makeTest inputs; }).local;
vmTestRemote = (import ./vmTest { inherit pkgs makeTest inputs; }).remote; vmTestRemote = (import ./vmTest { inherit pkgs makeTest inputs; }).remote;
vmTestLocalHermetic = (import ./vmTest { inherit pkgs makeTest inputs; }).localHermetic;
vmTestRemoteHermetic = (import ./vmTest { inherit pkgs makeTest inputs; }).remoteHermetic;
} }