This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

configs: allocate uids dynamically, drop stockholm.lib

pairprogramming, radio, realwallpaper and the htgen users no longer get
their ids from stockholm's genid. NixOS keeps the ids existing users
already have in /etc/passwd and /etc/group, so nothing changes on
deployed machines; fresh installs allocate them.

The copied htgen, reaktor2 and realwallpaper modules use nixpkgs option
types instead of stockholm's, htgen's user is a small name/home
submodule (home still defaults to /home/<name>), and reaktor2 carries
its own stripAttr.

+41 -17
-1
configs/pair-programming.nix
··· 5 5 }: 6 6 { 7 7 users.users.pairprogramming = { 8 - uid = self.inputs.stockholm.lib.genid_uint31 "pairprogramming"; 9 8 createHome = true; 10 9 isNormalUser = true; 11 10 openssh.authorizedKeys.keys = [
+24 -8
modules/htgen.nix
··· 1 1 # Copied from stockholm krebs/3modules/htgen.nix (cc283503); htgen now comes 2 - # from stockholm's packages output instead of its overlay. 2 + # from stockholm's packages output instead of its overlay. Users and groups 3 + # get their ids from NixOS instead of stockholm's genid. 3 4 { 4 5 config, 6 + lib, 5 7 pkgs, 6 8 self, 7 9 ... 8 10 }: 9 11 10 - with self.inputs.stockholm.lib; 12 + with lib; 11 13 let 12 14 optionalAttr = name: value: if name != null then { ${name} = value; } else { }; 13 15 ··· 27 29 enable = mkEnableOption "krebs.htgen-${config._module.args.name}"; 28 30 29 31 name = mkOption { 30 - type = types.username; 32 + # POSIX portable filename, like stockholm's types.username 33 + type = types.strMatching "[0-9A-Za-z._][0-9A-Za-z._-]*"; 31 34 default = config._module.args.name; 32 35 }; 33 36 ··· 37 40 }; 38 41 39 42 port = mkOption { 40 - type = types.uint; 43 + type = types.port; 41 44 }; 42 45 43 46 script = mkOption { ··· 46 49 }; 47 50 48 51 scriptFile = mkOption { 49 - type = types.nullOr (types.either types.package types.pathname); 52 + type = types.nullOr (types.either types.package types.path); 50 53 default = null; 51 54 }; 52 55 53 56 user = mkOption { 54 - type = types.user; 57 + type = types.submodule ( 58 + { config, ... }: 59 + { 60 + options = { 61 + name = mkOption { 62 + type = types.strMatching "[0-9A-Za-z._][0-9A-Za-z._-]*"; 63 + }; 64 + home = mkOption { 65 + type = types.path; 66 + # as stockholm's types.user 67 + default = "/home/${config.name}"; 68 + }; 69 + }; 70 + } 71 + ); 55 72 default = { 56 73 name = "htgen-${config.name}"; 57 74 home = "/var/lib/htgen-${config.name}"; ··· 91 108 users.users = mapAttrs' ( 92 109 name: htgen: 93 110 nameValuePair htgen.user.name { 94 - inherit (htgen.user) home name uid; 111 + inherit (htgen.user) home name; 95 112 group = htgen.user.name; 96 113 createHome = true; 97 114 isSystemUser = true; ··· 102 119 _name: htgen: 103 120 nameValuePair htgen.user.name { 104 121 name = htgen.user.name; 105 - gid = htgen.user.uid; 106 122 } 107 123 ) cfg; 108 124
+16 -5
modules/reaktor2.nix
··· 2 2 # pkgs/reaktor2, stockholm's packages output does not include it. 3 3 { 4 4 config, 5 + lib, 5 6 pkgs, 6 7 self, 7 8 ... 8 9 }: 9 - with self.inputs.stockholm.lib; 10 + with lib; 11 + let 12 + # drop null and empty attributes until nothing changes, like stockholm's 13 + # converge (filterAttrsRecursive …) 14 + stripAttr = 15 + x: 16 + let 17 + y = filterAttrsRecursive (_: v: v != { } && v != null) x; 18 + in 19 + if y == x then x else stripAttr y; 20 + in 10 21 { 11 22 12 23 options.krebs.reaktor2 = mkOption { ··· 26 37 }; 27 38 hostname = mkOption { 28 39 default = "irc.r"; 29 - type = types.hostname; 40 + type = types.str; 30 41 }; 31 42 port = mkOption { 32 43 default = "6667"; ··· 40 51 default = "/var/lib/${self.config.username}"; 41 52 defaultText = "/var/lib/‹username›"; 42 53 readOnly = true; 43 - type = types.absolute-pathname; 54 + type = types.path; 44 55 }; 45 56 systemd-service-name = mkOption { 46 57 default = "reaktor2${optionalString (name != "default") "-${name}"}"; 47 58 defaultText = "reaktor2-‹name› or just reaktor2 if ‹name› is \"default\""; 48 - type = types.filename; 59 + type = types.strMatching "[0-9A-Za-z._][0-9A-Za-z._-]*"; 49 60 }; 50 61 sendDelaySec = mkOption { 51 62 default = 0.7; ··· 54 65 username = mkOption { 55 66 default = self.config.systemd-service-name; 56 67 defaultText = "‹systemd-service-name›"; 57 - type = types.username; 68 + type = types.strMatching "[0-9A-Za-z._][0-9A-Za-z._-]*"; 58 69 }; 59 70 useTLS = mkOption { 60 71 default = self.config.port == "6697";
+1 -2
modules/realwallpaper.nix
··· 9 9 ... 10 10 }: 11 11 12 - with self.inputs.stockholm.lib; 12 + with lib; 13 13 let 14 14 cfg = config.krebs.realwallpaper; 15 15 ··· 69 69 }; 70 70 71 71 users.extraUsers.realwallpaper = { 72 - uid = genid "realwallpaper"; 73 72 group = "realwallpaper"; 74 73 home = cfg.workingDir; 75 74 createHome = true;
-1
configs/services/radio/default.nix
··· 87 87 inherit name; 88 88 createHome = true; 89 89 group = name; 90 - uid = self.inputs.stockholm.lib.genid_uint31 name; 91 90 description = "radio manager"; 92 91 home = "/home/${name}"; 93 92 useDefaultShell = true;