Configured self hosted cache

This commit is contained in:
Alejandro Angulo 2023-04-08 19:13:00 -07:00
parent cb449d6b09
commit 7d8328b880
Signed by: alejandro-angulo
GPG key ID: 75579581C74554B6
2 changed files with 17 additions and 0 deletions

View file

@ -7,6 +7,7 @@
}:
with lib; let
cfg = config.aa.nix;
selfHostedCacheHost = "192.168.113.69";
in {
options.aa.nix = with types; {
enable = mkEnableOption "manage nix configuration.";
@ -15,6 +16,8 @@ in {
default = pkgs.nixVersions.unstable;
description = "Which nix package to use.";
};
useSelfhostedCache = mkEnableOption "use self-hosted nix cache (currently hosted on gospel)";
};
config = mkIf cfg.enable {
@ -32,6 +35,19 @@ in {
experimental-features = "nix-command flakes";
trusted-users = users;
allowed-users = users;
builders-use-substitutes = cfg.useSelfhostedCache;
substituters =
if cfg.useSelfhostedCache
then [
selfHostedCacheHost
"https://cache.nixos.org"
]
else [];
trusted-public-keys =
if cfg.useSelfhostedCache
then ["gospelCache:9cbn8Wm54BbwpPS0TXw+15wrYZBpfOJt4Fzfbfcq/pc="]
else [];
};
gc = {

View file

@ -10,6 +10,7 @@
aa = {
nix.enable = true;
nix.useSelfhostedCache = true;
services.openssh.enable = true;
system.zfs.enable = true;