home/direnv: add auto prune timer

This commit is contained in:
Oystein Kristoffer Tveit 2024-08-12 17:36:13 +02:00
parent dfc0a3728d
commit 2f59d3d2bf
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
3 changed files with 43 additions and 1 deletions

View File

@ -11,7 +11,7 @@ in {
./programs/atuin.nix
./programs/comma.nix
./programs/direnv.nix
./programs/direnv
./programs/gdb.nix
./programs/gh.nix
./programs/git

View File

@ -0,0 +1,38 @@
{ config, pkgs, lib, ... }:
let
cfg = config.programs.direnv;
in
{
config = {
systemd.user.services.prune-allowed-direnv-dirs = {
Unit = {
Description = "Prune unused allowed directories for direnv";
Documentation = [ "man:direnv(1)" ];
};
Service = {
Type = "oneshot";
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
ExecStart = "${lib.getExe cfg.package} prune";
};
};
systemd.user.timers.prune-allowed-direnv-dirs = {
Unit = {
Description = "Prune unused allowed directories for direnv";
Documentation = [ "man:direnv(1)" ];
};
Timer = {
Unit = "prune-allowed-direnv-dirs.service";
OnCalendar = "daily";
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
};
};
}

View File

@ -1,5 +1,9 @@
{ ... }:
{
imports = [
./auto-prune.nix
];
programs.direnv = {
enable = true;
enableZshIntegration = true;