diff options
| author | Quentin Aristote <quentin@aristote.fr> | 2022-09-25 14:12:11 +0200 |
|---|---|---|
| committer | Quentin Aristote <quentin@aristote.fr> | 2022-09-25 14:12:11 +0200 |
| commit | d6080ef128404a97a0b7dc1653b78260d473f159 (patch) | |
| tree | 0bd433e30d78c8205912b5334848fbc4806f941e /nixos | |
| parent | 6b7c3879c75f41469edc6897a9dfabf5f0ae17d9 (diff) | |
move direnv-{clean,reload} services to home-manager
Diffstat (limited to 'nixos')
| -rw-r--r-- | nixos/services.nix | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/nixos/services.nix b/nixos/services.nix index f0a04ef..f8baf85 100644 --- a/nixos/services.nix +++ b/nixos/services.nix @@ -1,49 +1,23 @@ { lib, config, pkgs, ... }: -let - userService = user: { - serviceConfig.User = user; - environment.HOME = config.users.users."${user}".home; - }; -in { +{ # List services that you want to enable: # Enable the OpenSSH daemon. # services.openssh.enable = true; systemd.services = { - direnv-reload = { - enable = true; - description = "Update virtual environments of user qaristote"; - - restartIfChanged = false; - unitConfig.X-StopOnRemoval = false; - serviceConfig.Type = "oneshot"; - - environment.NIX_PATH = config.environment.sessionVariables.NIX_PATH; - - path = with pkgs; [ direnv ]; - script = - "find $HOME -type d -name .nix-gc-roots -execdir direnv exec . true \\;"; - - after = - lib.mkIf config.system.autoUpgrade.enable [ "nixos-upgrade.service" ]; - requiredBy = - lib.mkIf config.system.autoUpgrade.enable [ "nixos-upgrade.service" ]; - } // (userService "qaristote"); - direnv-prune = { + nix-gc-remove-dead-roots = { enable = true; - description = "Clean virtual environments of user qaristote"; + description = "Remove dead symlinks in /nix/var/nix/gcroots"; serviceConfig.Type = "oneshot"; - path = with pkgs; [ direnv ]; - script = "find $HOME -type d -name .direnv -execdir direnv prune \\;"; + script = "find /nix/var/nix/gcroots -xtype l -delete"; - after = [ "direnv-reload.service" ]; before = lib.mkIf config.nix.gc.automatic [ "nix-gc.service" ]; - requiredBy = lib.mkIf config.nix.gc.automatic [ "nix-gc.service" ]; - } // (userService "qaristote"); + wantedBy = lib.mkIf config.nix.gc.automatic [ "nix-gc.service" ]; + }; }; # virtualisation.docker.enable = true; |
