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"; };
|
||||
|
||||
enableBinaryCache = mkOption {
|
||||
type = bool;
|
||||
default = cfg.isInHq;
|
||||
defaultText = literalExample "config.c3d2.isInHq";
|
||||
description = "Whether to enable the local Nix binary cache";
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -101,7 +109,8 @@ in {
|
|||
mkIfIsInHq = lib.mkIf cfg.isInHq;
|
||||
in {
|
||||
|
||||
assertions = [{
|
||||
assertions = [
|
||||
{
|
||||
assertion = let
|
||||
check = hostName: hostName == config.networking.hostName;
|
||||
checkRegistry = list: builtins.any check list;
|
||||
|
@ -109,7 +118,12 @@ in {
|
|||
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";
|
||||
|
||||
|
@ -224,6 +238,15 @@ in {
|
|||
# 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 ];
|
||||
|
|
Loading…
Reference in New Issue
Block a user