3 This file is for options that NixOS and nix-darwin have in common.
5 Platform-specific code is in the respective default.nix files.
9 { config, lib, options, pkgs, ... }:
22 cfg = config.services.hercules-ci-agent;
24 inherit (import ./settings.nix { inherit pkgs lib; }) format settingsModule;
29 (mkRenamedOptionModule [ "services" "hercules-ci-agent" "extraOptions" ] [ "services" "hercules-ci-agent" "settings" ])
30 (mkRenamedOptionModule [ "services" "hercules-ci-agent" "baseDirectory" ] [ "services" "hercules-ci-agent" "settings" "baseDirectory" ])
31 (mkRenamedOptionModule [ "services" "hercules-ci-agent" "concurrentTasks" ] [ "services" "hercules-ci-agent" "settings" "concurrentTasks" ])
32 (mkRemovedOptionModule [ "services" "hercules-ci-agent" "patchNix" ] "Nix versions packaged in this version of Nixpkgs don't need a patched nix-daemon to work correctly in Hercules CI Agent clusters.")
35 options.services.hercules-ci-agent = {
40 Enable to run Hercules CI Agent as a system service.
42 [Hercules CI](https://hercules-ci.com) is a
43 continuous integation service that is centered around Nix.
45 Support is available at [help@hercules-ci.com](mailto:help@hercules-ci.com).
48 package = mkPackageOption pkgs "hercules-ci-agent" { };
51 These settings are written to the `agent.toml` file.
53 Not all settings are listed as options, can be set nonetheless.
55 For the exhaustive list of settings, see <https://docs.hercules-ci.com/hercules-ci/reference/agent-config/>.
57 type = types.submoduleWith { modules = [ settingsModule ]; };
61 Internal and/or computed values.
63 These are written as options instead of let binding to allow sharing with
64 default.nix on both NixOS and nix-darwin.
69 defaultText = lib.literalMD "generated `hercules-ci-agent.toml`";
71 The fully assembled config file.
76 config = mkIf cfg.enable {
77 # Make sure that nix.extraOptions does not override trusted-users
81 (cfg.settings.nixUserIsTrusted or false) ->
82 builtins.match ".*(^|\n)[ \t]*trusted-users[ \t]*=.*" config.nix.extraOptions == null;
84 hercules-ci-agent: Please do not set `trusted-users` in `nix.extraOptions`.
86 The hercules-ci-agent module by default relies on `nix.settings.trusted-users`
87 to be effectful, but a line like `trusted-users = ...` in `nix.extraOptions`
88 will override the value set in `nix.settings.trusted-users`.
90 Instead of setting `trusted-users` in the `nix.extraOptions` string, you should
91 set an option with additive semantics, such as
92 - the NixOS option `nix.settings.trusted-users`, or
93 - the Nix option in the `extraOptions` string, `extra-trusted-users`
98 # A store path that was missing at first may well have finished building,
99 # even shortly after the previous lookup. This *also* applies to the daemon.
100 narinfo-cache-negative-ttl = 0
102 services.hercules-ci-agent = {
104 format.generate "hercules-ci-agent.toml" cfg.settings;
105 settings.config._module.args = {
106 packageOption = options.services.hercules-ci-agent.package;