Commit d641b93e7bfa
Changed files (1)
modules
profiles
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" ];
+ };
+ }
+ )
+ ]);
}