From e8cd9d4b724fddfced2beddb48dba8aab0b52aaf Mon Sep 17 00:00:00 2001 From: Alexander Tomokhov Date: Thu, 28 Dec 2023 04:36:16 +0400 Subject: [PATCH] nixos: locking path:./sp-modules without flake.lock; cd /etc/nixos --- nixos/module.nix | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/nixos/module.nix b/nixos/module.nix index 38089fa..e936290 100644 --- a/nixos/module.nix +++ b/nixos/module.nix @@ -97,15 +97,16 @@ in # TODO set proper timeout for reboot instead of service restart serviceConfig = { User = "root"; + WorkingDirectory = "/etc/nixos"; KillMode = "none"; SendSIGKILL = "no"; }; script = '' # sync top-level flake with sp-modules sub-flake # (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 @@ -120,17 +121,16 @@ in path = [ pkgs.coreutils pkgs.gnutar pkgs.xz.bin pkgs.gzip pkgs.gitMinimal config.nix.package.out ]; serviceConfig = { User = "root"; + WorkingDirectory = "/etc/nixos"; KillMode = "none"; SendSIGKILL = "no"; }; script = '' - nix flake update /etc/nixos/sp-modules - # 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 - ${nixos-rebuild} switch --flake /etc/nixos#${config-id} + ${nixos-rebuild} switch --flake .#${config-id} ''; }; # 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 ]; serviceConfig = { User = "root"; + WorkingDirectory = "/etc/nixos"; ExecStart = - "${nixos-rebuild} switch --rollback --flake /etc/nixos#${config-id}"; + "${nixos-rebuild} switch --rollback --flake .#${config-id}"; KillMode = "none"; SendSIGKILL = "no"; };