home: add automatic home-manager cleanup service
This commit is contained in:
parent
e649117615
commit
a899d5b159
28
user/home-manager.nix
Normal file
28
user/home-manager.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{ pkgs, lib, ... }:
|
||||
{
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
systemd.user.services.home-manager-expire = {
|
||||
Unit = {
|
||||
Description = "Remove old home-manager generations";
|
||||
};
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = pkgs.writeShellScript "home-manager-expire" ''
|
||||
${lib.getExe pkgs.home-manager} expire-generations 7d
|
||||
'';
|
||||
};
|
||||
};
|
||||
systemd.user.timers.home-manager-expire = {
|
||||
Unit = {
|
||||
Description = "Remove old home-manager generations";
|
||||
};
|
||||
Timer = {
|
||||
OnCalendar = "daily";
|
||||
Unit = "home-manager-expire.service";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "timers.target" ];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -9,6 +9,7 @@
|
|||
{
|
||||
imports = [
|
||||
./dummy.nix
|
||||
./home-manager.nix
|
||||
./waybar
|
||||
./helix.nix
|
||||
./kakoune
|
||||
|
@ -58,8 +59,6 @@
|
|||
home.username = "lelgenio";
|
||||
home.homeDirectory = "/home/lelgenio";
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
home.packages = with pkgs; [
|
||||
terminal
|
||||
|
||||
|
|
Loading…
Reference in a new issue