1
0
Fork 0

Fix update-system script

This commit is contained in:
Malte 2023-03-12 02:15:09 +01:00
parent 4e4d2a2652
commit 1ef4873f4e

View file

@ -57,8 +57,8 @@ final: _: let
} '' } ''
main = do main = do
${get_hostname} ${get_hostname}
say [i|Building ~/.modes for #{hostname}|]
${get_builders} ${get_builders}
say [i|Building modes for #{hostname} …|]
nom ["build", "--builders", [i|@#{builders}|], [i|${configPath}\#homeModes.#{hostname}|], "-o", "${modeDir}"] nom ["build", "--builders", [i|@#{builders}|], [i|${configPath}\#homeModes.#{hostname}|], "-o", "${modeDir}"]
activate_mode activate_mode
''; '';
@ -82,8 +82,10 @@ final: _: let
set -e set -e
remote_host=$1 remote_host=$1
host=''${remote_host:-$(hostname)} host=''${remote_host:-$(hostname)}
echo "Evaluating configuration for $host "
outputDrv=$(nix eval --raw $HOME/git/config#nixosConfigurations.$host.config.system.build.toplevel.drvPath)
echo "Building configuration for $host " echo "Building configuration for $host "
output=$(nom build --builders @$(builders-configurator) /home/maralorn/git/config#nixosConfigurations.$host.config.system.build.toplevel --no-link --print-out-paths) output=$(nom build --builders @$(builders-configurator) $outputDrv --no-link --print-out-paths)
if [[ -z "$remote_host" ]]; then if [[ -z "$remote_host" ]]; then
on_target() { on_target() {
/run/wrappers/bin/sudo $@ /run/wrappers/bin/sudo $@
@ -93,7 +95,7 @@ final: _: let
${pkgs.lib.getExe pkgs.openssh} root@$host $@ ${pkgs.lib.getExe pkgs.openssh} root@$host $@
} }
echo "Uploading configuration to $host " echo "Uploading configuration to $host "
${final.lib.getExe pkgs.nix} copy $output --to ssh://$host ${final.lib.getExe pkgs.nix} copy $outputDrv $output --to ssh-ng://$host
fi fi
on_target ${pkgs.nix}/bin/nix-env -p /nix/var/nix/profiles/system --set $output on_target ${pkgs.nix}/bin/nix-env -p /nix/var/nix/profiles/system --set $output
on_target $output/bin/switch-to-configuration switch on_target $output/bin/switch-to-configuration switch