mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-23 20:44:12 +00:00
nixos/services.cntlm: remove with lib;
This commit is contained in:
parent
5506afac27
commit
5438332690
@ -1,7 +1,4 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.services.cntlm;
|
cfg = config.services.cntlm;
|
||||||
@ -16,11 +13,11 @@ let
|
|||||||
Username ${cfg.username}
|
Username ${cfg.username}
|
||||||
Domain ${cfg.domain}
|
Domain ${cfg.domain}
|
||||||
Password ${cfg.password}
|
Password ${cfg.password}
|
||||||
${optionalString (cfg.netbios_hostname != "") "Workstation ${cfg.netbios_hostname}"}
|
${lib.optionalString (cfg.netbios_hostname != "") "Workstation ${cfg.netbios_hostname}"}
|
||||||
${concatMapStrings (entry: "Proxy ${entry}\n") cfg.proxy}
|
${lib.concatMapStrings (entry: "Proxy ${entry}\n") cfg.proxy}
|
||||||
${optionalString (cfg.noproxy != []) "NoProxy ${concatStringsSep ", " cfg.noproxy}"}
|
${lib.optionalString (cfg.noproxy != []) "NoProxy ${lib.concatStringsSep ", " cfg.noproxy}"}
|
||||||
|
|
||||||
${concatMapStrings (port: ''
|
${lib.concatMapStrings (port: ''
|
||||||
Listen ${toString port}
|
Listen ${toString port}
|
||||||
'') cfg.port}
|
'') cfg.port}
|
||||||
|
|
||||||
@ -33,36 +30,36 @@ in
|
|||||||
|
|
||||||
options.services.cntlm = {
|
options.services.cntlm = {
|
||||||
|
|
||||||
enable = mkEnableOption "cntlm, which starts a local proxy";
|
enable = lib.mkEnableOption "cntlm, which starts a local proxy";
|
||||||
|
|
||||||
username = mkOption {
|
username = lib.mkOption {
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
description = ''
|
description = ''
|
||||||
Proxy account name, without the possibility to include domain name ('at' sign is interpreted literally).
|
Proxy account name, without the possibility to include domain name ('at' sign is interpreted literally).
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
domain = mkOption {
|
domain = lib.mkOption {
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
description = "Proxy account domain/workgroup name.";
|
description = "Proxy account domain/workgroup name.";
|
||||||
};
|
};
|
||||||
|
|
||||||
password = mkOption {
|
password = lib.mkOption {
|
||||||
default = "/etc/cntlm.password";
|
default = "/etc/cntlm.password";
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
description = "Proxy account password. Note: use chmod 0600 on /etc/cntlm.password for security.";
|
description = "Proxy account password. Note: use chmod 0600 on /etc/cntlm.password for security.";
|
||||||
};
|
};
|
||||||
|
|
||||||
netbios_hostname = mkOption {
|
netbios_hostname = lib.mkOption {
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
default = "";
|
default = "";
|
||||||
description = ''
|
description = ''
|
||||||
The hostname of your machine.
|
The hostname of your machine.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
proxy = mkOption {
|
proxy = lib.mkOption {
|
||||||
type = types.listOf types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
description = ''
|
description = ''
|
||||||
A list of NTLM/NTLMv2 authenticating HTTP proxies.
|
A list of NTLM/NTLMv2 authenticating HTTP proxies.
|
||||||
|
|
||||||
@ -73,29 +70,29 @@ in
|
|||||||
example = [ "proxy.example.com:81" ];
|
example = [ "proxy.example.com:81" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
noproxy = mkOption {
|
noproxy = lib.mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
A list of domains where the proxy is skipped.
|
A list of domains where the proxy is skipped.
|
||||||
'';
|
'';
|
||||||
default = [];
|
default = [];
|
||||||
type = types.listOf types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
example = [ "*.example.com" "example.com" ];
|
example = [ "*.example.com" "example.com" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
port = mkOption {
|
port = lib.mkOption {
|
||||||
default = [3128];
|
default = [3128];
|
||||||
type = types.listOf types.port;
|
type = lib.types.listOf lib.types.port;
|
||||||
description = "Specifies on which ports the cntlm daemon listens.";
|
description = "Specifies on which ports the cntlm daemon listens.";
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = lib.mkOption {
|
||||||
type = types.lines;
|
type = lib.types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
description = "Additional config appended to the end of the generated {file}`cntlm.conf`.";
|
description = "Additional config appended to the end of the generated {file}`cntlm.conf`.";
|
||||||
};
|
};
|
||||||
|
|
||||||
configText = mkOption {
|
configText = lib.mkOption {
|
||||||
type = types.lines;
|
type = lib.types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
description = "Verbatim contents of {file}`cntlm.conf`.";
|
description = "Verbatim contents of {file}`cntlm.conf`.";
|
||||||
};
|
};
|
||||||
@ -104,7 +101,7 @@ in
|
|||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
systemd.services.cntlm = {
|
systemd.services.cntlm = {
|
||||||
description = "CNTLM is an NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy";
|
description = "CNTLM is an NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
|
Loading…
Reference in New Issue
Block a user