This repository has no description
1.6 kB
62 lines
1# krebs.hosts and foreign krebs.users from the kartei flake input, instead
2# of stockholm's nixosModules.kartei (which pins its own kartei submodule).
3# Our own users are defined here from ../keys, not taken from kartei.
4{
5 config,
6 lib,
7 self,
8 ...
9}:
10let
11 inherit (self.inputs) kartei;
12
13 # Host flag that is stockholm policy (krebs/3modules/kartei/overlay.nix),
14 # not kartei data, still read by configs/consul.nix (retry_join).
15 consulHosts = [
16 "aergia"
17 "blue"
18 "coaxmetal"
19 "daedalus"
20 "green"
21 "icarus"
22 "ignavia"
23 "littleT"
24 "massulus"
25 "neoprism"
26 "orange"
27 "radio"
28 "shodan"
29 "skynet"
30 "styx"
31 "ubik"
32 "yellow"
33 ];
34
35 ownUsers = {
36 lass = {
37 mail = "lass@green.r";
38 pgp.pubkeys.default = builtins.readFile ../keys/pgp/yubi_pgp.pgp;
39 pubkey = lib.removeSuffix "\n" (builtins.readFile ../keys/ssh/yubi_pgp.pub);
40 };
41 };
42in
43{
44 krebs.hosts = lib.mapAttrs (
45 name: host:
46 removeAttrs host [ "owner" ]
47 // {
48 # hosts may be owned by users without a kartei record; the krebs.users
49 # type fills in all defaults from the name alone
50 owner = config.krebs.users.${host.owner} or { name = host.owner; };
51 consul = lib.elem name consulHosts;
52 }
53 ) kartei.hosts;
54
55 # drop null fields so other modules (e.g. stockholm's users.nix for the
56 # krebs user) can define them without conflicting definitions
57 krebs.users =
58 lib.mapAttrs (_: lib.filterAttrs (_: v: v != null)) (
59 removeAttrs kartei.users (lib.attrNames ownUsers)
60 )
61 // ownUsers;
62}