mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-12 01:59:37 +08:00
nh: remove redundant platform checks
This commit is contained in:
@@ -100,7 +100,7 @@ in
|
|||||||
lib.optional (cfg.clean.enable && config.nix.gc.automatic)
|
lib.optional (cfg.clean.enable && config.nix.gc.automatic)
|
||||||
"programs.nh.clean.enable and nix.gc.automatic (Home-Manager) are both enabled. Please use one or the other to avoid conflict.";
|
"programs.nh.clean.enable and nix.gc.automatic (Home-Manager) are both enabled. Please use one or the other to avoid conflict.";
|
||||||
|
|
||||||
assertions = lib.optionals pkgs.stdenv.isDarwin [
|
assertions = [
|
||||||
(lib.hm.darwin.assertInterval "programs.nh.clean.dates" cfg.clean.dates pkgs)
|
(lib.hm.darwin.assertInterval "programs.nh.clean.dates" cfg.clean.dates pkgs)
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -131,30 +131,25 @@ in
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user = lib.mkIf (cfg.clean.enable && pkgs.stdenv.isLinux) {
|
systemd.user = lib.mkIf cfg.clean.enable {
|
||||||
services.nh-clean = {
|
services.nh-clean = {
|
||||||
Unit.Description = "Nh clean (user)";
|
Unit.Description = "Nh clean (user)";
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = "${lib.getExe cfg.package} clean user ${cfg.clean.extraArgs}";
|
ExecStart = "${lib.getExe cfg.package} clean user ${cfg.clean.extraArgs}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
timers.nh-clean = {
|
timers.nh-clean = {
|
||||||
Unit.Description = "Run nh clean";
|
Unit.Description = "Run nh clean";
|
||||||
|
|
||||||
Timer = {
|
Timer = {
|
||||||
OnCalendar = cfg.clean.dates;
|
OnCalendar = cfg.clean.dates;
|
||||||
Persistent = true;
|
Persistent = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
Install.WantedBy = [ "timers.target" ];
|
Install.WantedBy = [ "timers.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
launchd.agents.nh-clean = lib.mkIf (cfg.clean.enable && pkgs.stdenv.isDarwin) {
|
launchd.agents.nh-clean = lib.mkIf cfg.clean.enable {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = {
|
config = {
|
||||||
ProgramArguments = [
|
ProgramArguments = [
|
||||||
@@ -163,9 +158,7 @@ in
|
|||||||
"user"
|
"user"
|
||||||
]
|
]
|
||||||
++ lib.optional (cfg.clean.extraArgs != "") cfg.clean.extraArgs;
|
++ lib.optional (cfg.clean.extraArgs != "") cfg.clean.extraArgs;
|
||||||
|
|
||||||
StartCalendarInterval = lib.hm.darwin.mkCalendarInterval cfg.clean.dates;
|
StartCalendarInterval = lib.hm.darwin.mkCalendarInterval cfg.clean.dates;
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user