forked from lebzm/homini
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnixos.nix
More file actions
41 lines (39 loc) · 1.05 KB
/
nixos.nix
File metadata and controls
41 lines (39 loc) · 1.05 KB
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
{ config, lib, pkgs, ... }:
let
hominiConfigModule = import ./module.nix;
hominiConfigType = lib.types.submoduleWith {
modules = [ hominiConfigModule ];
specialArgs = { inherit pkgs; };
shorthandOnlyDefinesConfig = true;
};
hominiUserType = lib.types.submoduleWith {
modules = [
{
options.homini = lib.mkOption {
type = lib.types.nullOr hominiConfigType;
default = null;
description = ''
Homini configuration for this user.
'';
};
}
];
shorthandOnlyDefinesConfig = true;
};
enabledUsers = lib.filterAttrs (_: userCfg: userCfg.homini != null) config.users.users;
in
{
options.users.users = lib.mkOption {
type = lib.types.attrsOf hominiUserType;
};
config.system.userActivationScripts = lib.mapAttrs' (
name: userCfg:
lib.nameValuePair "homini-${name}" {
text = ''
if [[ "$USER" == ${lib.escapeShellArg name} ]]; then
"${userCfg.homini.activationPackage}/bin/homini"
fi
'';
}
) enabledUsers;
}