cntlm: refactor to systemd service, fixes #11339

authored by

Markus Wotringer and committed by
Rok Garbas
9a350d5f f399ab50

+16 -18
+16 -18
nixos/modules/services/networking/cntlm.nix
··· 73 73 ###### implementation 74 74 75 75 config = mkIf config.services.cntlm.enable { 76 - 76 + systemd.services.cntlm = { 77 + description = "CNTLM is an NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy"; 78 + after = [ "network.target" ]; 79 + wantedBy = [ "multi-user.target" ]; 80 + serviceConfig = { 81 + Type = "forking"; 82 + User = "cntlm"; 83 + ExecStart = '' 84 + ${pkgs.cntlm}/bin/cntlm -U cntlm \ 85 + -c ${pkgs.writeText "cntlm_config" cfg.extraConfig} 86 + ''; 87 + }; 88 + }; 89 + 77 90 services.cntlm.netbios_hostname = mkDefault config.networking.hostName; 78 91 79 - users.extraUsers = singleton { 92 + users.extraUsers.cntlm = { 80 93 name = "cntlm"; 81 94 description = "cntlm system-wide daemon"; 82 95 home = "/var/empty"; 83 96 }; 84 97 85 - jobs.cntlm = 86 - { description = "CNTLM is an NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy"; 87 - 88 - startOn = "started network-interfaces"; 89 - 90 - daemonType = "fork"; 91 - 92 - exec = 93 - '' 94 - ${pkgs.cntlm}/bin/cntlm -U cntlm \ 95 - -c ${pkgs.writeText "cntlm_config" cfg.extraConfig} 96 - ''; 97 - }; 98 - 99 98 services.cntlm.extraConfig = 100 99 '' 101 100 # Cntlm Authentication Proxy Configuration ··· 108 107 ${concatMapStrings (port: '' 109 108 Listen ${toString port} 110 109 '') cfg.port} 111 - ''; 112 - 110 + ''; 113 111 }; 114 112 115 113 }