simplify specialisation behavior
All checks were successful
Hydra nixosConfigurations.container-default-riscv64-linux Hydra build #23772 of nixos-config:pr618:nixosConfigurations.container-default-riscv64-linux
Hydra nixosConfigurations.container-default-x86_64-linux Hydra build #23773 of nixos-config:pr618:nixosConfigurations.container-default-x86_64-linux
Hydra nixosConfigurations.container-default-aarch64-linux Hydra build #23771 of nixos-config:pr618:nixosConfigurations.container-default-aarch64-linux
Hydra nixosConfigurations.pc-installer Hydra build #23776 of nixos-config:pr618:nixosConfigurations.pc-installer
Hydra checks.x86_64-linux.containers-default Hydra build #23770 of nixos-config:pr618:checks.x86_64-linux.containers-default
Hydra nixosConfigurations.not522 Hydra build #23774 of nixos-config:pr618:nixosConfigurations.not522
Hydra nixosConfigurations.not522-installer Hydra build #23775 of nixos-config:pr618:nixosConfigurations.not522-installer
All checks were successful
Hydra nixosConfigurations.container-default-riscv64-linux Hydra build #23772 of nixos-config:pr618:nixosConfigurations.container-default-riscv64-linux
Hydra nixosConfigurations.container-default-x86_64-linux Hydra build #23773 of nixos-config:pr618:nixosConfigurations.container-default-x86_64-linux
Hydra nixosConfigurations.container-default-aarch64-linux Hydra build #23771 of nixos-config:pr618:nixosConfigurations.container-default-aarch64-linux
Hydra nixosConfigurations.pc-installer Hydra build #23776 of nixos-config:pr618:nixosConfigurations.pc-installer
Hydra checks.x86_64-linux.containers-default Hydra build #23770 of nixos-config:pr618:checks.x86_64-linux.containers-default
Hydra nixosConfigurations.not522 Hydra build #23774 of nixos-config:pr618:nixosConfigurations.not522
Hydra nixosConfigurations.not522-installer Hydra build #23775 of nixos-config:pr618:nixosConfigurations.not522-installer
This commit is contained in:
parent
a683dcd651
commit
c4303b853a
1 changed files with 10 additions and 17 deletions
|
@ -49,7 +49,12 @@ in
|
|||
|
||||
serviceConfig.Type = "oneshot";
|
||||
|
||||
script = ''
|
||||
script = let
|
||||
switchToConfiguration =
|
||||
if cfg.specialisation == null
|
||||
then "$output/bin/switch-to-configuration switch"
|
||||
else "$output/specialisation/${cfg.specialisation}/bin/switch-to-configuration";
|
||||
in ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
set -euxo pipefail
|
||||
build=$(${pkgs.curl}/bin/curl -H "accept: application/json" -G ${cfg.hydraServer}/api/latestbuilds -d "nr=10" -d "project=${cfg.project}" -d "jobset=${cfg.jobset}" -d "job=${cfg.job}" | ${pkgs.jq}/bin/jq -r '[.[]|select(.buildstatus==0)][0].id')
|
||||
|
@ -60,30 +65,18 @@ in
|
|||
${
|
||||
if cfg.reboot
|
||||
then ''
|
||||
$output/bin/switch-to-configuration boot
|
||||
${switchToConfiguration} boot
|
||||
booted="$(${pkgs.coreutils}/bin/readlink /run/booted-system/{initrd,kernel,kernel-modules})"
|
||||
built="$(${pkgs.coreutils}/bin/readlink $output/{initrd,kernel,kernel-modules})"
|
||||
if [ "$booted" = "$built" ]; then
|
||||
${
|
||||
if cfg.specialisation == null
|
||||
then "$output/bin/switch-to-configuration switch"
|
||||
else ''
|
||||
$output/specialisation/${cfg.specialisation}/bin/switch-to-configuration switch
|
||||
''
|
||||
}
|
||||
${switchToConfiguration} switch
|
||||
else
|
||||
${pkgs.systemd}/bin/shutdown -r +1
|
||||
fi
|
||||
exit
|
||||
''
|
||||
else ''
|
||||
${
|
||||
if cfg.specialisation == null
|
||||
then "$output/bin/switch-to-configuration switch"
|
||||
else ''
|
||||
$output/specialisation/${cfg.specialisation}/bin/switch-to-configuration switch
|
||||
''
|
||||
}
|
||||
${switchToConfiguration} switch
|
||||
''
|
||||
}
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue