nix-serve should no longer use the default store. Move binaryCaches into the machine submodule.
This commit is contained in:
parent
89debb2c37
commit
345c054448
3 changed files with 19 additions and 9 deletions
|
@ -1,6 +1,8 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
let
|
||||
cfg = config.machine;
|
||||
in {
|
||||
nix = {
|
||||
maxJobs = 4;
|
||||
buildCores = 1;
|
||||
|
@ -9,14 +11,12 @@
|
|||
extraOptions = ''
|
||||
build-timeout = 86400 # 24 hours
|
||||
'';
|
||||
binaryCachePublicKeys = [ (lib.fileContents "${config.machine.secretPath}/hydra_cache.pub") ];
|
||||
binaryCachePublicKeys = [ (lib.fileContents "${cfg.secretPath}/hydra_cache.pub") ];
|
||||
trustedBinaryCaches = [
|
||||
"https://cache.nixos.org"
|
||||
"https://cache.ophanim.de"
|
||||
];
|
||||
] ++ cfg.binaryCaches;
|
||||
binaryCaches = [
|
||||
"https://cache.nixos.org"
|
||||
"https://cache.ophanim.de"
|
||||
];
|
||||
] ++ cfg.binaryCaches;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -59,6 +59,13 @@ in {
|
|||
The Machines HostName
|
||||
'';
|
||||
};
|
||||
binaryCaches = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [];
|
||||
description = ''
|
||||
Adds binary caches to both nix.trustedBinaryCaches and nix.binaryCaches. ("https://cache.nixos.org" is kept by default)
|
||||
'';
|
||||
};
|
||||
secretPath = mkOption {
|
||||
type = types.str;
|
||||
default = (findFirst (elem: elem.prefix == "secretPath") { path = "/secret"; } builtins.nixPath).path;
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
|
||||
with lib;
|
||||
|
||||
mkIf (elem "hydra" config.machine.services) {
|
||||
let
|
||||
cacheDir = "/var/cache/hydra";
|
||||
in mkIf (elem "hydra" config.machine.services) {
|
||||
# also take a look at ../conf/nix.nix
|
||||
nix.buildMachines = [
|
||||
{
|
||||
|
@ -40,7 +42,7 @@ mkIf (elem "hydra" config.machine.services) {
|
|||
# hydra.conf: binary_cache_secret_key_file is deprecated and ignored. use store_uri=...?secret-key= instead
|
||||
extraConfig = ''
|
||||
max_output_size = 4294967296
|
||||
store_uri = file:///var/cache/hydra?secret-key=${cfg.secretPath}/hydra_cache&write-nar-listing=1&ls-compression=br&log-compression=br
|
||||
store_uri = file://${cacheDir}?secret-key=${cfg.secretPath}/hydra_cache&write-nar-listing=1&ls-compression=br&log-compression=br
|
||||
# add ?local-nar-cache= to set nar cache location
|
||||
server_store_uri = https://cache.${cfg.domain}
|
||||
binary_cache_public_uri https://cache.${cfg.domain}
|
||||
|
@ -59,5 +61,6 @@ mkIf (elem "hydra" config.machine.services) {
|
|||
# --group hydra
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
systemd.services.nix-serve.environment.NIX_STORE_DIR = cacheDir;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue