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 with lib; let
cfg = config.aa.nix; cfg = config.aa.nix;
selfHostedCacheHost = "192.168.113.69";
in { in {
options.aa.nix = with types; { options.aa.nix = with types; {
enable = mkEnableOption "manage nix configuration."; enable = mkEnableOption "manage nix configuration.";
@ -15,6 +16,8 @@ in {
default = pkgs.nixVersions.unstable; default = pkgs.nixVersions.unstable;
description = "Which nix package to use."; description = "Which nix package to use.";
}; };
useSelfhostedCache = mkEnableOption "use self-hosted nix cache (currently hosted on gospel)";
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -32,6 +35,19 @@ in {
experimental-features = "nix-command flakes"; experimental-features = "nix-command flakes";
trusted-users = users; trusted-users = users;
allowed-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 = { gc = {

View file

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