mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-21 01:39:39 +01:00
services.home-manager.autoExpire: wrap systemd configuration within a isLinux condition
This commit is contained in:
parent
45c2985644
commit
382b34f656
1 changed files with 32 additions and 32 deletions
|
|
@ -70,40 +70,40 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable (
|
||||||
assertions = [
|
lib.mkMerge [
|
||||||
(lib.hm.assertions.assertPlatform "services.home-manager.autoExpire" pkgs lib.platforms.linux)
|
(lib.mkIf pkgs.stdenv.isLinux {
|
||||||
];
|
systemd.user = {
|
||||||
|
timers.home-manager-auto-expire = {
|
||||||
|
Unit.Description = "Home Manager expire generations timer";
|
||||||
|
|
||||||
systemd.user = {
|
Install.WantedBy = [ "timers.target" ];
|
||||||
timers.home-manager-auto-expire = {
|
|
||||||
Unit.Description = "Home Manager expire generations timer";
|
|
||||||
|
|
||||||
Install.WantedBy = [ "timers.target" ];
|
Timer = {
|
||||||
|
OnCalendar = cfg.frequency;
|
||||||
|
Unit = "home-manager-auto-expire.service";
|
||||||
|
Persistent = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
Timer = {
|
services.home-manager-auto-expire = {
|
||||||
OnCalendar = cfg.frequency;
|
Unit.Description = "Home Manager expire generations";
|
||||||
Unit = "home-manager-auto-expire.service";
|
|
||||||
Persistent = true;
|
Service.ExecStart = toString (
|
||||||
|
pkgs.writeShellScript "home-manager-auto-expire" (
|
||||||
|
''
|
||||||
|
echo "Expire old Home Manager generations"
|
||||||
|
${homeManagerPackage}/bin/home-manager expire-generations '${cfg.timestamp}'
|
||||||
|
''
|
||||||
|
+ lib.optionalString cfg.store.cleanup ''
|
||||||
|
echo "Clean-up Nix store"
|
||||||
|
${pkgs.nix}/bin/nix-collect-garbage ${cfg.store.options}
|
||||||
|
''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
})
|
||||||
|
]
|
||||||
services.home-manager-auto-expire = {
|
);
|
||||||
Unit.Description = "Home Manager expire generations";
|
|
||||||
|
|
||||||
Service.ExecStart = toString (
|
|
||||||
pkgs.writeShellScript "home-manager-auto-expire" (
|
|
||||||
''
|
|
||||||
echo "Expire old Home Manager generations"
|
|
||||||
${homeManagerPackage}/bin/home-manager expire-generations '${cfg.timestamp}'
|
|
||||||
''
|
|
||||||
+ lib.optionalString cfg.store.cleanup ''
|
|
||||||
echo "Clean-up Nix store"
|
|
||||||
${pkgs.nix}/bin/nix-collect-garbage ${cfg.store.options}
|
|
||||||
''
|
|
||||||
)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue