···437437 riak = 205;
438438 #shout = 206; #unused
439439 gateone = 207;
440440- #namecoin = 208; #unused
440440+ namecoin = 208;
441441442442 # When adding a gid, make sure it doesn't match an existing
443443 # uid. Users and groups with the same name should have equal
+23-1
nixos/modules/services/networking/namecoind.nix
···4545 type = types.path;
4646 example = "/etc/namecoin/wallet.dat";
4747 description = ''
4848- Wallet file.
4848+ Wallet file. The ownership of the file has to be
4949+ namecoin:namecoin, and the permissions must be 0640.
4950 '';
5051 };
5152···6162 USER=namecoin
6263 PASSWORD=secret
6364 </literal>
6565+ The ownership of the file has to be namecoin:namecoin,
6666+ and the permissions must be 0640.
6467 '';
6568 };
6669···107110 createHome = true;
108111 };
109112113113+ users.extraGroups = singleton
114114+ { name = "namecoin";
115115+ gid = config.ids.gids.namecoin;
116116+ };
117117+110118 systemd.services.namecoind = {
111119 description = "Namecoind Daemon";
112120 after = [ "network.target" ];
113121 wantedBy = [ "multi-user.target" ];
122122+ preStart = ''
123123+ if [ "$(stat --printf '%u' ${cfg.userFile})" != "${toString config.ids.uids.namecoin}" \
124124+ -o "$(stat --printf '%g' ${cfg.userFile})" != "${toString config.ids.gids.namecoin}" \
125125+ -o "$(stat --printf '%a' ${cfg.userFile})" != "640" ]; then
126126+ echo "ERROR: bad ownership or rights on ${cfg.userFile}" >&2
127127+ exit 1
128128+ fi
129129+ if [ "$(stat --printf '%u' ${cfg.wallet})" != "${toString config.ids.uids.namecoin}" \
130130+ -o "$(stat --printf '%g' ${cfg.wallet})" != "${toString config.ids.gids.namecoin}" \
131131+ -o "$(stat --printf '%a' ${cfg.wallet})" != "640" ]; then
132132+ echo "ERROR: bad ownership or rights on ${cfg.wallet}" >&2
133133+ exit 1
134134+ fi
135135+ '';
114136 serviceConfig = {
115137 Type = "simple";
116138 User = "namecoin";