nixos/services.cachix-agent: remove `with lib;`

Changed files
+14 -17
nixos
modules
services
system
cachix-agent
+14 -17
nixos/modules/services/system/cachix-agent/default.nix
···
lib,
...
}:
-
-
with lib;
-
let
cfg = config.services.cachix-agent;
in
···
meta.maintainers = [ lib.maintainers.domenkozar ];
options.services.cachix-agent = {
-
enable = mkEnableOption "Cachix Deploy Agent: https://docs.cachix.org/deploy/";
-
name = mkOption {
-
type = types.str;
description = "Agent name, usually same as the hostname";
default = config.networking.hostName;
defaultText = "config.networking.hostName";
};
-
verbose = mkOption {
-
type = types.bool;
description = "Enable verbose output";
default = false;
};
-
profile = mkOption {
-
type = types.nullOr types.str;
default = null;
description = "Profile name, defaults to 'system' (NixOS).";
};
-
host = mkOption {
-
type = types.nullOr types.str;
default = null;
description = "Cachix uri to use.";
};
-
package = mkPackageOption pkgs "cachix" { };
-
credentialsFile = mkOption {
-
type = types.path;
default = "/etc/cachix-agent.token";
description = ''
Required file that needs to contain CACHIX_AGENT_TOKEN=...
···
};
};
-
config = mkIf cfg.enable {
systemd.services.cachix-agent = {
description = "Cachix Deploy Agent";
wants = [ "network-online.target" ];
···
${cfg.package}/bin/cachix ${lib.optionalString cfg.verbose "--verbose"} ${
lib.optionalString (cfg.host != null) "--host ${cfg.host}"
} \
-
deploy agent ${cfg.name} ${optionalString (cfg.profile != null) cfg.profile}
'';
};
};
···
lib,
...
}:
let
cfg = config.services.cachix-agent;
in
···
meta.maintainers = [ lib.maintainers.domenkozar ];
options.services.cachix-agent = {
+
enable = lib.mkEnableOption "Cachix Deploy Agent: https://docs.cachix.org/deploy/";
+
name = lib.mkOption {
+
type = lib.types.str;
description = "Agent name, usually same as the hostname";
default = config.networking.hostName;
defaultText = "config.networking.hostName";
};
+
verbose = lib.mkOption {
+
type = lib.types.bool;
description = "Enable verbose output";
default = false;
};
+
profile = lib.mkOption {
+
type = lib.types.nullOr lib.types.str;
default = null;
description = "Profile name, defaults to 'system' (NixOS).";
};
+
host = lib.mkOption {
+
type = lib.types.nullOr lib.types.str;
default = null;
description = "Cachix uri to use.";
};
+
package = lib.mkPackageOption pkgs "cachix" { };
+
credentialsFile = lib.mkOption {
+
type = lib.types.path;
default = "/etc/cachix-agent.token";
description = ''
Required file that needs to contain CACHIX_AGENT_TOKEN=...
···
};
};
+
config = lib.mkIf cfg.enable {
systemd.services.cachix-agent = {
description = "Cachix Deploy Agent";
wants = [ "network-online.target" ];
···
${cfg.package}/bin/cachix ${lib.optionalString cfg.verbose "--verbose"} ${
lib.optionalString (cfg.host != null) "--host ${cfg.host}"
} \
+
deploy agent ${cfg.name} ${lib.optionalString (cfg.profile != null) cfg.profile}
'';
};
};