commit d641b93e7bfa6b68bb9684ab866c75230f49532e parent 2395181f0fee625defb6b8d9c178b9758733395a Author: Vincent Demeester <vincent@sbr.pm> Date: Fri, 5 Jun 2020 14:54:45 +0200 nix-auto-update: reformatted Signed-off-by: Vincent Demeester <vincent@sbr.pm> Diffstat:
M | modules/profiles/nix-auto-update.nixos.nix | | | 103 | ++++++++++++++++++++++++++++++++++++++----------------------------------------- |
1 file changed, 49 insertions(+), 54 deletions(-)
diff --git a/modules/profiles/nix-auto-update.nixos.nix b/modules/profiles/nix-auto-update.nixos.nix @@ -29,58 +29,53 @@ in }; }; }; - config = - mkIf - cfg.enable - ( - mkMerge [ - { - system = { - stateVersion = cfg.version; - }; - } - ( - mkIf cfg.autoUpgrade { - systemd.services.nixos-update = { - description = "NixOS Upgrade"; - unitConfig.X-StopOnRemoval = false; - restartIfChanged = false; - serviceConfig.Type = "oneshot"; - environment = config.nix.envVars - // { - inherit (config.environment.sessionVariables) NIX_PATH; - HOME = "/root"; - }; - path = [ pkgs.gnutar pkgs.xz pkgs.git pkgs.gnumake config.nix.package.out pkgs.commonsCompress ]; - script = '' - export PATH=/run/current-system/sw/bin - cd /etc/nixos/ - make update nixos-switch - ''; - startAt = cfg.dates; - onFailure = [ "status-email-root@%n.service" ]; - }; - systemd.services.etc-nixos-git-update = { - description = "Update NixOS source git repository"; - unitConfig.X-StopOnRemoval = false; - restartIfChanged = false; - serviceConfig.Type = "oneshot"; - serviceConfig.User = "vincent"; - environment = config.nix.envVars - // { - inherit (config.environment.sessionVariables) NIX_PATH; - }; - path = [ pkgs.gnutar pkgs.xz pkgs.git ]; - script = '' - export PATH=/run/current-system/sw/bin - cd /etc/nixos/ - git pull --rebase --autostash --recurse-submodules - ''; - startAt = "daily"; - onFailure = [ "status-email-root@%n.service" ]; - }; - } - ) - ] - ); + config = mkIf cfg.enable (mkMerge [ + { + system = { + stateVersion = cfg.version; + }; + } + ( + mkIf cfg.autoUpgrade { + systemd.services.nixos-update = { + description = "NixOS Upgrade"; + unitConfig.X-StopOnRemoval = false; + restartIfChanged = false; + serviceConfig.Type = "oneshot"; + environment = config.nix.envVars + // { + inherit (config.environment.sessionVariables) NIX_PATH; + HOME = "/root"; + }; + path = [ pkgs.gnutar pkgs.xz pkgs.git pkgs.gnumake config.nix.package.out pkgs.commonsCompress ]; + script = '' + export PATH=/run/current-system/sw/bin + cd /etc/nixos/ + make update nixos-switch + ''; + startAt = cfg.dates; + onFailure = [ "status-email-root@%n.service" ]; + }; + systemd.services.etc-nixos-git-update = { + description = "Update NixOS source git repository"; + unitConfig.X-StopOnRemoval = false; + restartIfChanged = false; + serviceConfig.Type = "oneshot"; + serviceConfig.User = "vincent"; + environment = config.nix.envVars + // { + inherit (config.environment.sessionVariables) NIX_PATH; + }; + path = [ pkgs.gnutar pkgs.xz pkgs.git ]; + script = '' + export PATH=/run/current-system/sw/bin + cd /etc/nixos/ + git pull --rebase --autostash --recurse-submodules + ''; + startAt = "daily"; + onFailure = [ "status-email-root@%n.service" ]; + }; + } + ) + ]); }