2 This file is for options that NixOS and nix-darwin have in common.
4 Platform-specific code is in the respective default.nix files.
26 cfg = config.services.hercules-ci-agent;
28 inherit (import ./settings.nix { inherit pkgs lib; }) format settingsModule;
33 (mkRenamedOptionModule
34 [ "services" "hercules-ci-agent" "extraOptions" ]
35 [ "services" "hercules-ci-agent" "settings" ]
37 (mkRenamedOptionModule
38 [ "services" "hercules-ci-agent" "baseDirectory" ]
39 [ "services" "hercules-ci-agent" "settings" "baseDirectory" ]
41 (mkRenamedOptionModule
42 [ "services" "hercules-ci-agent" "concurrentTasks" ]
43 [ "services" "hercules-ci-agent" "settings" "concurrentTasks" ]
45 (mkRemovedOptionModule [ "services" "hercules-ci-agent" "patchNix" ]
46 "Nix versions packaged in this version of Nixpkgs don't need a patched nix-daemon to work correctly in Hercules CI Agent clusters."
50 options.services.hercules-ci-agent = {
55 Enable to run Hercules CI Agent as a system service.
57 [Hercules CI](https://hercules-ci.com) is a
58 continuous integation service that is centered around Nix.
60 Support is available at [help@hercules-ci.com](mailto:help@hercules-ci.com).
63 package = mkPackageOption pkgs "hercules-ci-agent" { };
66 These settings are written to the `agent.toml` file.
68 Not all settings are listed as options, can be set nonetheless.
70 For the exhaustive list of settings, see <https://docs.hercules-ci.com/hercules-ci/reference/agent-config/>.
72 type = types.submoduleWith { modules = [ settingsModule ]; };
76 Internal and/or computed values.
78 These are written as options instead of let binding to allow sharing with
79 default.nix on both NixOS and nix-darwin.
84 defaultText = lib.literalMD "generated `hercules-ci-agent.toml`";
86 The fully assembled config file.
91 config = mkIf cfg.enable {
92 # Make sure that nix.extraOptions does not override trusted-users
96 (cfg.settings.nixUserIsTrusted or false)
97 -> builtins.match ".*(^|\n)[ \t]*trusted-users[ \t]*=.*" config.nix.extraOptions == null;
99 hercules-ci-agent: Please do not set `trusted-users` in `nix.extraOptions`.
101 The hercules-ci-agent module by default relies on `nix.settings.trusted-users`
102 to be effectful, but a line like `trusted-users = ...` in `nix.extraOptions`
103 will override the value set in `nix.settings.trusted-users`.
105 Instead of setting `trusted-users` in the `nix.extraOptions` string, you should
106 set an option with additive semantics, such as
107 - the NixOS option `nix.settings.trusted-users`, or
108 - the Nix option in the `extraOptions` string, `extra-trusted-users`
112 nix.extraOptions = ''
113 # A store path that was missing at first may well have finished building,
114 # even shortly after the previous lookup. This *also* applies to the daemon.
115 narinfo-cache-negative-ttl = 0
117 services.hercules-ci-agent = {
118 tomlFile = format.generate "hercules-ci-agent.toml" cfg.settings;
119 settings.config._module.args = {
120 packageOption = options.services.hercules-ci-agent.package;