mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 23:43:30 +00:00
nixos/services.distccd: remove with lib;
This commit is contained in:
parent
dee0a91730
commit
8ddfb1375f
@ -1,17 +1,14 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.distccd;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services.distccd = {
|
||||
enable = mkEnableOption "distccd, a distributed C/C++ compiler";
|
||||
enable = lib.mkEnableOption "distccd, a distributed C/C++ compiler";
|
||||
|
||||
allowedClients = mkOption {
|
||||
type = types.listOf types.str;
|
||||
allowedClients = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ "127.0.0.1" ];
|
||||
example = [ "127.0.0.1" "192.168.0.0/24" "10.0.0.0/24" ];
|
||||
description = ''
|
||||
@ -23,16 +20,16 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
jobTimeout = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
jobTimeout = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.int;
|
||||
default = null;
|
||||
description = ''
|
||||
Maximum duration, in seconds, of a single compilation request.
|
||||
'';
|
||||
};
|
||||
|
||||
logLevel = mkOption {
|
||||
type = types.nullOr (types.enum [ "critical" "error" "warning" "notice" "info" "debug" ]);
|
||||
logLevel = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.enum [ "critical" "error" "warning" "notice" "info" "debug" ]);
|
||||
default = "warning";
|
||||
description = ''
|
||||
Set the minimum severity of error that will be included in the log
|
||||
@ -41,35 +38,35 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
maxJobs = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
maxJobs = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.int;
|
||||
default = null;
|
||||
description = ''
|
||||
Maximum number of tasks distccd should execute at any time.
|
||||
Maximum number of tasks distccd should execute at lib.any time.
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
nice = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
nice = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.int;
|
||||
default = null;
|
||||
description = ''
|
||||
Niceness of the compilation tasks.
|
||||
'';
|
||||
};
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
openFirewall = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Opens the specified TCP port for distcc.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkPackageOption pkgs "distcc" { };
|
||||
package = lib.mkPackageOption pkgs "distcc" { };
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 3632;
|
||||
description = ''
|
||||
The TCP port which distccd will listen on.
|
||||
@ -77,9 +74,9 @@ in
|
||||
};
|
||||
|
||||
stats = {
|
||||
enable = mkEnableOption "statistics reporting via HTTP server";
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
enable = lib.mkEnableOption "statistics reporting via HTTP server";
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 3633;
|
||||
description = ''
|
||||
The TCP port which the distccd statistics HTTP server will listen
|
||||
@ -88,8 +85,8 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
zeroconf = mkOption {
|
||||
type = types.bool;
|
||||
zeroconf = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to register via mDNS/DNS-SD
|
||||
@ -98,10 +95,10 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
networking.firewall = mkIf cfg.openFirewall {
|
||||
config = lib.mkIf cfg.enable {
|
||||
networking.firewall = lib.mkIf cfg.openFirewall {
|
||||
allowedTCPPorts = [ cfg.port ]
|
||||
++ optionals cfg.stats.enable [ cfg.stats.port ];
|
||||
++ lib.optionals cfg.stats.enable [ cfg.stats.port ];
|
||||
};
|
||||
|
||||
systemd.services.distccd = {
|
||||
@ -124,14 +121,14 @@ in
|
||||
--daemon \
|
||||
--enable-tcp-insecure \
|
||||
--port ${toString cfg.port} \
|
||||
${optionalString (cfg.jobTimeout != null) "--job-lifetime ${toString cfg.jobTimeout}"} \
|
||||
${optionalString (cfg.logLevel != null) "--log-level ${cfg.logLevel}"} \
|
||||
${optionalString (cfg.maxJobs != null) "--jobs ${toString cfg.maxJobs}"} \
|
||||
${optionalString (cfg.nice != null) "--nice ${toString cfg.nice}"} \
|
||||
${optionalString cfg.stats.enable "--stats"} \
|
||||
${optionalString cfg.stats.enable "--stats-port ${toString cfg.stats.port}"} \
|
||||
${optionalString cfg.zeroconf "--zeroconf"} \
|
||||
${concatMapStrings (c: "--allow ${c} ") cfg.allowedClients}
|
||||
${lib.optionalString (cfg.jobTimeout != null) "--job-lifetime ${toString cfg.jobTimeout}"} \
|
||||
${lib.optionalString (cfg.logLevel != null) "--log-level ${cfg.logLevel}"} \
|
||||
${lib.optionalString (cfg.maxJobs != null) "--jobs ${toString cfg.maxJobs}"} \
|
||||
${lib.optionalString (cfg.nice != null) "--nice ${toString cfg.nice}"} \
|
||||
${lib.optionalString cfg.stats.enable "--stats"} \
|
||||
${lib.optionalString cfg.stats.enable "--stats-port ${toString cfg.stats.port}"} \
|
||||
${lib.optionalString cfg.zeroconf "--zeroconf"} \
|
||||
${lib.concatMapStrings (c: "--allow ${c} ") cfg.allowedClients}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user