mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-16 21:38:21 +00:00
This process was automated by [my fork of `nix-doc-munge`]; thanks to @pennae for writing this tool! It automatically checks that the resulting documentation doesn't change, although my fork loosens this a little to ignore some irrelevant whitespace and typographical differences. As of this commit there is no DocBook remaining in the options documentation. You can play along at home if you want to reproduce this commit: $ NIX_PATH=nixpkgs=flake:nixpkgs/c1bca7fe84c646cfd4ebf3482c0e6317a0b13f22 \ nix shell nixpkgs#coreutils \ -c find . -name '*.nix' \ -exec nix run github:emilazy/nix-doc-munge/0a7190f600027bf7baf6cb7139e4d69ac2f51062 \ {} + [my fork of `nix-doc-munge`]: https://github.com/emilazy/nix-doc-munge
76 lines
1.9 KiB
Nix
76 lines
1.9 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.cachix-agent;
|
|
in {
|
|
options.services.cachix-agent = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = lib.mdDoc ''
|
|
Enable to run Cachix Agent as a system service.
|
|
|
|
Read [Cachix Deploy](https://docs.cachix.org/deploy/) documentation for more information.
|
|
'';
|
|
};
|
|
|
|
name = mkOption {
|
|
type = types.str;
|
|
default = config.networking.hostName;
|
|
description = lib.mdDoc ''
|
|
Agent name, usually the same as the hostname.
|
|
'';
|
|
};
|
|
|
|
package = mkOption {
|
|
description = lib.mdDoc ''
|
|
Package containing cachix executable.
|
|
'';
|
|
type = types.package;
|
|
default = pkgs.cachix;
|
|
defaultText = literalExpression "pkgs.cachix";
|
|
};
|
|
|
|
credentialsFile = mkOption {
|
|
type = types.path;
|
|
default = "/etc/cachix-agent.token";
|
|
description = lib.mdDoc ''
|
|
Required file that needs to contain CACHIX_AGENT_TOKEN=...
|
|
'';
|
|
};
|
|
|
|
logFile = mkOption {
|
|
type = types.nullOr types.path;
|
|
default = "/var/log/cachix-agent.log";
|
|
description = lib.mdDoc "Absolute path to log all stderr and stdout";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
launchd.daemons.cachix-agent = {
|
|
script = ''
|
|
. ${cfg.credentialsFile}
|
|
|
|
exec ${cfg.package}/bin/cachix deploy agent ${cfg.name}
|
|
'';
|
|
|
|
path = [ config.nix.package pkgs.coreutils ];
|
|
|
|
environment = {
|
|
NIX_SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
|
|
USER = "root";
|
|
};
|
|
|
|
serviceConfig.KeepAlive = true;
|
|
serviceConfig.RunAtLoad = true;
|
|
serviceConfig.ProcessType = "Interactive";
|
|
serviceConfig.StandardErrorPath = cfg.logFile;
|
|
serviceConfig.StandardOutPath = cfg.logFile;
|
|
serviceConfig.WatchPaths = [
|
|
cfg.credentialsFile
|
|
];
|
|
};
|
|
};
|
|
}
|