1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7with lib;
8let
9 cfg = config.services.nullidentdmod;
10
11in
12{
13 options.services.nullidentdmod = with types; {
14 enable = mkEnableOption "the nullidentdmod identd daemon";
15
16 userid = mkOption {
17 type = nullOr str;
18 description = "User ID to return. Set to null to return a random string each time.";
19 default = null;
20 example = "alice";
21 };
22 };
23
24 config = mkIf cfg.enable {
25 systemd.sockets.nullidentdmod = {
26 description = "Socket for identd (NullidentdMod)";
27 listenStreams = [ "113" ];
28 socketConfig.Accept = true;
29 wantedBy = [ "sockets.target" ];
30 };
31
32 systemd.services."nullidentdmod@" = {
33 description = "NullidentdMod service";
34 serviceConfig = {
35 DynamicUser = true;
36 ExecStart = "${pkgs.nullidentdmod}/bin/nullidentdmod${
37 optionalString (cfg.userid != null) " ${cfg.userid}"
38 }";
39 StandardInput = "socket";
40 StandardOutput = "socket";
41 };
42 };
43 };
44}