blob: f0a04efbdcc497dd36d65b739bab5feb69377d7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
{ 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 = {
enable = true;
description = "Clean virtual environments of user qaristote";
serviceConfig.Type = "oneshot";
path = with pkgs; [ direnv ];
script = "find $HOME -type d -name .direnv -execdir direnv prune \\;";
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");
};
# virtualisation.docker.enable = true;
}
|