nixcache: tidy up substituter config

This commit is contained in:
Colin 2023-07-14 22:33:33 +00:00
parent fdc18821ca
commit 2f5c33b2b4
2 changed files with 18 additions and 11 deletions

View File

@ -22,6 +22,8 @@
sane.services.wg-home.enable = true;
sane.services.wg-home.enableWan = true;
sane.services.wg-home.ip = config.sane.hosts.by-name."servo".wg-home.ip;
sane.services.nixcache.substituters.servo.enable = false;
sane.services.nixcache.substituters.desko.enable = false;
# sane.services.duplicity.enable = true; # TODO: re-enable after HW upgrade
# automatically log in at the virtual consoles.

View File

@ -25,16 +25,16 @@ in
default = config.sane.nixcache.enable;
type = types.bool;
};
sane.nixcache.substituters = mkOption {
type = types.listOf types.str;
default =
# TODO: make these blacklisted entries injectable
(lib.optional (hostName != "servo") "https://nixcache.uninsane.org")
++ (lib.optional (hostName != "servo" && hostName != "desko") "http://desko:5000")
++ [
"https://nix-community.cachix.org"
"https://cache.nixos.org/"
];
sane.nixcache.substituters = let
subOpt = mkOption {
default = true;
type = types.bool;
};
in {
servo = subOpt;
desko = subOpt;
nixos = subOpt;
cachix = subOpt;
};
};
@ -43,7 +43,12 @@ in
# to explicitly build from a specific cache (in case others are down):
# - `nixos-rebuild ... --option substituters https://cache.nixos.org`
# - `nix build ... --substituters http://desko:5000`
nix.settings.substituters = mkIf cfg.enable cfg.substituters;
nix.settings.substituters = mkIf cfg.enable (lib.flatten [
(lib.optional cfg.substituters.servo "https://nixcache.uninsane.org")
(lib.optional cfg.substituters.desko "http://desko:5000")
(lib.optional cfg.substituters.nixos "https://cache.nixos.org/")
(lib.optional cfg.substituters.cachix "https://nix-community.cachix.org")
]);
# always trust our keys (so one can explicitly use a substituter even if it's not the default
nix.settings.trusted-public-keys = mkIf cfg.enable-trusted-keys [
"nixcache.uninsane.org:r3WILM6+QrkmsLgqVQcEdibFD7Q/4gyzD9dGT33GP70="