blob: d663ec38d1aacc8274fdaf5617ad111c044dd5d0 (
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
|
{ config, lib, pkgs, ... }:
let cfg = config.libkookie;
in
{
options.libkookie = {
activeUsers = with lib; mkOption {
type = with types; listOf str;
default = [];
description = ''
List of active users on this system. This is relevant for what
userspace tools get installed, and what SSH pubkeys are included.
'';
};
userPath = with lib; mkOption {
type = types.path;
default = null;
description = ''
Base path to the user definitions. Because of the way that
libkookie is structured, user declarations don't like in the
./module tree, but instead should be kept in the ./config tree.
This way, the separation between the actual modules, and system
configuration for a particular system remains intact.
'';
};
};
config = {
users.mutableUsers = false;
users.users = (with lib;
let
pathify = with builtins;
name: cfg.userPath + (toPath "/" + name + ".nix");
include = path: import path { inherit pkgs lib; };
in
listToAttrs (map
(name: nameValuePair name (include (pathify name)))
cfg.activeUsers));
};
}
|