services.home-manager.autoExpire: extract cleanup script to new variable
This commit is contained in:
parent
382b34f656
commit
04ebd2c422
1 changed files with 12 additions and 12 deletions
|
|
@ -13,6 +13,17 @@ let
|
|||
path = config.programs.home-manager.path;
|
||||
};
|
||||
|
||||
script = 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}
|
||||
''
|
||||
);
|
||||
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ lib.maintainers.thiagokokada ];
|
||||
|
|
@ -89,18 +100,7 @@ in
|
|||
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}
|
||||
''
|
||||
)
|
||||
);
|
||||
Service.ExecStart = toString script;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue