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