nixos: locking path:./sp-modules without flake.lock; cd /etc/nixos

This commit is contained in:
Alexander Tomokhov 2023-12-28 04:36:16 +04:00
parent 5bf42a8bc1
commit e8cd9d4b72

View file

@ -97,15 +97,16 @@ in
# TODO set proper timeout for reboot instead of service restart # TODO set proper timeout for reboot instead of service restart
serviceConfig = { serviceConfig = {
User = "root"; User = "root";
WorkingDirectory = "/etc/nixos";
KillMode = "none"; KillMode = "none";
SendSIGKILL = "no"; SendSIGKILL = "no";
}; };
script = '' script = ''
# sync top-level flake with sp-modules sub-flake # sync top-level flake with sp-modules sub-flake
# (https://github.com/NixOS/nix/issues/9339) # (https://github.com/NixOS/nix/issues/9339)
nix flake lock /etc/nixos --update-input sp-modules nix flake lock --override-input sp-modules path:./sp-modules
${nixos-rebuild} switch --flake /etc/nixos#${config-id} ${nixos-rebuild} switch --flake .#${config-id}
''; '';
}; };
# One shot systemd service to upgrade NixOS using nixos-rebuild # One shot systemd service to upgrade NixOS using nixos-rebuild
@ -120,17 +121,16 @@ in
path = [ pkgs.coreutils pkgs.gnutar pkgs.xz.bin pkgs.gzip pkgs.gitMinimal config.nix.package.out ]; path = [ pkgs.coreutils pkgs.gnutar pkgs.xz.bin pkgs.gzip pkgs.gitMinimal config.nix.package.out ];
serviceConfig = { serviceConfig = {
User = "root"; User = "root";
WorkingDirectory = "/etc/nixos";
KillMode = "none"; KillMode = "none";
SendSIGKILL = "no"; SendSIGKILL = "no";
}; };
script = '' script = ''
nix flake update /etc/nixos/sp-modules
# FIXME get URL from systemd parameter # FIXME get URL from systemd parameter
nix flake update /etc/nixos \ nix flake update \
--override-input selfprivacy-nixos-config git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git?ref=flakes --override-input selfprivacy-nixos-config git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git?ref=flakes
${nixos-rebuild} switch --flake /etc/nixos#${config-id} ${nixos-rebuild} switch --flake .#${config-id}
''; '';
}; };
# One shot systemd service to rollback NixOS using nixos-rebuild # One shot systemd service to rollback NixOS using nixos-rebuild
@ -145,8 +145,9 @@ in
path = [ pkgs.coreutils pkgs.gnutar pkgs.xz.bin pkgs.gzip pkgs.gitMinimal config.nix.package.out ]; path = [ pkgs.coreutils pkgs.gnutar pkgs.xz.bin pkgs.gzip pkgs.gitMinimal config.nix.package.out ];
serviceConfig = { serviceConfig = {
User = "root"; User = "root";
WorkingDirectory = "/etc/nixos";
ExecStart = ExecStart =
"${nixos-rebuild} switch --rollback --flake /etc/nixos#${config-id}"; "${nixos-rebuild} switch --rollback --flake .#${config-id}";
KillMode = "none"; KillMode = "none";
SendSIGKILL = "no"; SendSIGKILL = "no";
}; };