diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index da774b9..3dd8537 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -20,6 +20,7 @@ jobs: extra_nix_config: | # Make sure we're using sandbox sandbox-fallback = false + extra-substituters = https://nix-cache.nul.ie/main extra-trusted-public-keys = main:mMChkG8LwXrFirVfudqjSHasK1jV31OVElYD3eImYl8= - name: Set up attic diff --git a/devshell/default.nix b/devshell/default.nix index fce4efd..66ba449 100644 --- a/devshell/default.nix +++ b/devshell/default.nix @@ -1,6 +1,5 @@ { lib, pkgs, ... }: let - inherit (lib) concatStringsSep; inherit (lib.my) attrsToNVList; in { @@ -13,9 +12,7 @@ in NIX_USER_CONF_FILES = toString (pkgs.writeText "nix.conf" '' experimental-features = nix-command flakes ca-derivations repl-flake - #substituters = https://nix-cache.nul.ie https://cache.nixos.org - substituters = https://cache.nixos.org - trusted-public-keys = ${concatStringsSep " " lib.my.c.nix.cacheKeys} + ${lib.my.c.nix.cache.conf} ''); INSTALLER_SSH_OPTS = "-i .keys/deploy.key"; diff --git a/home-manager/modules/common.nix b/home-manager/modules/common.nix index d2a7ac0..049d01e 100644 --- a/home-manager/modules/common.nix +++ b/home-manager/modules/common.nix @@ -235,12 +235,9 @@ in exact = true; }; }; - settings = { - substituters = [ - #"https://nix-cache.nul.ie" - "https://cache.nixos.org" - ]; - trusted-public-keys = lib.my.c.nix.cacheKeys; + settings = with lib.my.c.nix; { + extra-substituters = cache.substituters; + extra-trusted-public-keys = cache.keys; }; }; }) diff --git a/lib/constants.nix b/lib/constants.nix index 24e7751..ed8f4f2 100644 --- a/lib/constants.nix +++ b/lib/constants.nix @@ -1,4 +1,8 @@ -{ lib }: rec { +{ lib }: +let + inherit (lib) concatStringsSep; +in +rec { # See https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/misc/ids.nix ids = { uids = { @@ -32,10 +36,18 @@ }; nix = { - cacheKeys = [ - "nix-cache.nul.ie-1:XofkqdHQSGFoPjB6aRohQbCU2ILKFqhNjWfoOdQgF5Y=" - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - ]; + cache = rec { + substituters = [ + "https://nix-cache.${pubDomain}/main" + ]; + keys = [ + "main:mMChkG8LwXrFirVfudqjSHasK1jV31OVElYD3eImYl8=" + ]; + conf = '' + extra-substituters = ${concatStringsSep " " substituters} + extra-trusted-public-keys = ${concatStringsSep " " keys} + ''; + }; }; pubDomain = "nul.ie"; diff --git a/nixos/modules/common.nix b/nixos/modules/common.nix index c7383a7..e5230d7 100644 --- a/nixos/modules/common.nix +++ b/nixos/modules/common.nix @@ -41,14 +41,11 @@ in nix = { package = pkgs'.mine.nix; - settings = { + settings = with lib.my.c.nix; { trusted-users = [ "@wheel" ]; experimental-features = [ "nix-command" "flakes" "ca-derivations" ]; - substituters = [ - #"https://nix-cache.nul.ie" - "https://cache.nixos.org" - ]; - trusted-public-keys = lib.my.c.nix.cacheKeys; + extra-substituters = cache.substituters; + extra-trusted-public-keys = cache.keys; }; registry = { pkgs = {