omnixient/modules/cache.nix
2026-06-28 09:59:04 +02:00

45 lines
1.6 KiB
Nix

# Binary cache configuration.
#
# Substituters and trusted public keys for cache.nixos.org and
# nix-community, plus a stub for the aiolabs cache (uncomment when
# configured). Imported by every host that wants pre-built artifacts
# instead of compiling from source.
#
# Why this exists as its own module: the optimize-deploys/unified flake
# notes that host1/host3/host2 share ~90% of derivations, so the second
# and third deploys would be near-instant once a cache is set up. Same
# applies for the dev box rebuilds. Rather than scatter substituter
# configuration across every host, define it once.
#
# Pushing to the cache is one Makefile target (`make cache`) — see the
# top-level Makefile.
{ ... }:
{
nix.settings = {
substituters = [
"https://cache.nixos.org"
"https://nix-community.cachix.org"
# Uncomment when the aiolabs cache is configured.
# "https://aiolabs-nix.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
# Add the aiolabs cache public key here once we generate it:
# cachix authtoken <token>
# cachix create aiolabs-nix
# The public key is shown after `cachix create`.
# "aiolabs-nix.cachix.org-1:..."
];
# Allow more substituters at runtime via `--option extra-substituters`
# without editing this file. Useful for one-off testing.
trusted-substituters = [
"https://cache.nixos.org"
"https://nix-community.cachix.org"
];
};
}