diff --git a/modules/nix-darwin/default.nix b/modules/nix-darwin/default.nix index 2426f39..0c224a3 100644 --- a/modules/nix-darwin/default.nix +++ b/modules/nix-darwin/default.nix @@ -280,6 +280,14 @@ in The Sentry endpoint for uploading crash reports. Set to `null` to disable crash reporting. ''; }; + edgeCacheSubstituters = lib.mkOption { + type = types.nullOr (types.listOf types.str); + default = null; + example = [ "https://cache.example.com/" ]; + description = '' + A list of substituter URLs that Determinate Nixd should treat as edge caches. These URLs are written as the top-level `edgeCacheSubstituters` key in {file}`/etc/determinate/config.json`. + ''; + }; }; }; default = { }; @@ -783,6 +791,7 @@ in "garbageCollector" "strategy" ] + [ "edgeCacheSubstituters" ] ] ); configAttrs = diff --git a/modules/nixos.nix b/modules/nixos.nix index 682a6c8..42216a0 100644 --- a/modules/nixos.nix +++ b/modules/nixos.nix @@ -56,6 +56,15 @@ in enable = lib.mkEnableOption "Determinate Nix" // { default = true; }; + + edgeCacheSubstituters = lib.mkOption { + type = lib.types.nullOr (lib.types.listOf lib.types.str); + default = null; + example = [ "https://cache.example.com/" ]; + description = '' + A list of substituter URLs that Determinate Nixd should treat as edge caches. These URLs are written as the top-level `edgeCacheSubstituters` key in {file}`/etc/determinate/config.json`. + ''; + }; }; config = lib.mkIf cfg.enable { @@ -67,6 +76,12 @@ in # the Determinate Nixd-managed /etc/nix/nix.conf. environment.etc."nix/nix.conf".target = "nix/nix.custom.conf"; + environment.etc."determinate/config.json" = lib.mkIf (cfg.edgeCacheSubstituters != null) { + text = builtins.toJSON { + edgeCacheSubstituters = cfg.edgeCacheSubstituters; + }; + }; + systemd = { services.nix-daemon.serviceConfig = { ExecStart = [