Remove hydra cache, add enableBinaryCache to hq module
The Hydra is dead, NixOS machines cannot rely on services hosted from the Proxmox. Add a enableBinaryCache option to the hq module to enable caching from Server7.
This commit is contained in:
parent
76145d112d
commit
a203683694
|
@ -91,6 +91,14 @@ in {
|
||||||
|
|
||||||
statistics = { enable = mkEnableOption "statistics collection"; };
|
statistics = { enable = mkEnableOption "statistics collection"; };
|
||||||
|
|
||||||
|
enableBinaryCache = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = cfg.isInHq;
|
||||||
|
defaultText = literalExample "config.c3d2.isInHq";
|
||||||
|
description = "Whether to enable the local Nix binary cache";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -101,15 +109,21 @@ in {
|
||||||
mkIfIsInHq = lib.mkIf cfg.isInHq;
|
mkIfIsInHq = lib.mkIf cfg.isInHq;
|
||||||
in {
|
in {
|
||||||
|
|
||||||
assertions = [{
|
assertions = [
|
||||||
assertion = let
|
{
|
||||||
check = hostName: hostName == config.networking.hostName;
|
assertion = let
|
||||||
checkRegistry = list: builtins.any check list;
|
check = hostName: hostName == config.networking.hostName;
|
||||||
in cfg.isInHq -> checkRegistry hostRegistry.hqLocal;
|
checkRegistry = list: builtins.any check list;
|
||||||
message = "${config.networking.hostName} is not registered in ${
|
in cfg.isInHq -> checkRegistry hostRegistry.hqLocal;
|
||||||
toString ../host-registry.nix
|
message = "${config.networking.hostName} is not registered in ${
|
||||||
}";
|
toString ../host-registry.nix
|
||||||
}];
|
}";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
assertion = cfg.hq.enableBinaryCache -> cfg.mapHqHosts;
|
||||||
|
message = "mapHqHosts must be enabled for enableBinaryCache";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
networking.defaultGateway = mkIfIsInHq "172.22.99.4";
|
networking.defaultGateway = mkIfIsInHq "172.22.99.4";
|
||||||
|
|
||||||
|
@ -224,6 +238,15 @@ in {
|
||||||
# Only builds > 19.09
|
# Only builds > 19.09
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nix = lib.mkIf
|
||||||
|
(cfg.hq.enableBinaryCache && config.networking.hostName != "server7") {
|
||||||
|
binaryCaches =
|
||||||
|
[ "http://server7.hq:${toString config.services.nix-serve.port}" ];
|
||||||
|
binaryCachePublicKeys = [
|
||||||
|
"cache.server7.hq.c3d2.de:x8JLRG26zRZ8ysYZLEkPxuAYuK1VSJi/aMAEIs2Lv+U="
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
meta.maintainers = with lib.maintainers; [ ehmry ];
|
meta.maintainers = with lib.maintainers; [ ehmry ];
|
||||||
|
|
Loading…
Reference in New Issue