From 1657e95a5d98bf26dac41562463884ca427c8b5e Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Fri, 7 Nov 2025 11:36:23 +0100 Subject: [PATCH] yeet cachix --- flake.nix | 23 ++++++++------- profiles/base/binary-caches.nix | 39 ++++++++++++++++++++++++++ profiles/base/cachix.nix | 13 --------- profiles/base/cachix/flox.nix | 13 --------- profiles/base/cachix/nix-community.nix | 13 --------- profiles/base/cachix/numtide.nix | 13 --------- profiles/base/default.nix | 2 +- 7 files changed, 53 insertions(+), 63 deletions(-) create mode 100644 profiles/base/binary-caches.nix delete mode 100644 profiles/base/cachix.nix delete mode 100644 profiles/base/cachix/flox.nix delete mode 100644 profiles/base/cachix/nix-community.nix delete mode 100644 profiles/base/cachix/numtide.nix diff --git a/flake.nix b/flake.nix index d2b5d5b..6abd4cf 100644 --- a/flake.nix +++ b/flake.nix @@ -117,16 +117,19 @@ }; - nixConfig.extra-substituters = [ - "https://nix-community.cachix.org?priority=1" # less is more /shrug - "https://numtide.cachix.org" # dead? https://github.com/numtide/nixpkgs-unfree/commit/399ae17bda97a0318a0c5316edb169d097a776dc - "https://cache.flox.dev" # https://flox.dev/blog/flox-the-nix-foundation-and-nvidia-partner-for-cuda/ - ]; - nixConfig.extra-trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - "numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE=" - "flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs=" - ]; + nixConfig = { + # matches ./profiles/base/binary-caches.nix + extra-substituters = [ + "https://nix-community.cachix.org/" + # "https://numtide.cachix.org/" # dead? https://github.com/numtide/nixpkgs-unfree/commit/399ae17bda97a0318a0c5316edb169d097a776dc + "https://cache.flox.dev/?priority=45" # https://flox.dev/blog/flox-the-nix-foundation-and-nvidia-partner-for-cuda/ + ]; + extra-trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + # "numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE=" + "flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs=" + ]; + }; outputs = { self, ... } @ inputs': let diff --git a/profiles/base/binary-caches.nix b/profiles/base/binary-caches.nix new file mode 100644 index 0000000..6d091f1 --- /dev/null +++ b/profiles/base/binary-caches.nix @@ -0,0 +1,39 @@ +#!/usr/bin/env -S nix eval --json --file +let + caches = { + # lower ?priority=x numbers go first, will fallback to https://.../nix-cache-info if unset, final fallback is the default 0 + # https://nix.dev/manual/nix/latest/command-ref/conf-file#conf-substituters + # https://nix.dev/manual/nix/latest/command-ref/conf-file#conf-trusted-public-keys + + # https://cache.nixos.org/nix-cache-info (WantMassQuery: 1, priority: 40) + "https://cache.nixos.org/" = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + ]; + + # https://nix-community.cachix.org/nix-cache-info (WantMassQuery: 1, priority: 41) + "https://nix-community.cachix.org/" = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + + # # dead? https://github.com/numtide/nixpkgs-unfree/commit/399ae17bda97a0318a0c5316edb169d097a776dc + # # https://numtide.cachix.org/nix-cache-info (WantMassQuery: 1, priority: 41) + # "https://numtide.cachix.org/" = [ + # "numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE=" + # ]; + + # https://flox.dev/blog/flox-the-nix-foundation-and-nvidia-partner-for-cuda/ + # https://cache.flox.dev/nix-cache-info (no WantMassQuery, no priority(!!!)) + "https://cache.flox.dev/?priority=45" = [ + "flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs=" + ]; + }; +in + +{ + nix.settings = { + # nixos will add the public binary cache as well with a mkAfter, unless we mkForce these + substituters = builtins.attrNames caches; + trusted-substituters = builtins.attrNames caches; + trusted-public-keys = builtins.concatLists (builtins.attrValues caches); + }; +} diff --git a/profiles/base/cachix.nix b/profiles/base/cachix.nix deleted file mode 100644 index ecd2d39..0000000 --- a/profiles/base/cachix.nix +++ /dev/null @@ -1,13 +0,0 @@ - -# WARN: this file will get overwritten by $ cachix use -{ pkgs, lib, ... }: - -let - folder = ./cachix; - toImport = name: value: folder + ("/" + name); - filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key; - imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder)); -in { - inherit imports; - nix.settings.substituters = ["https://cache.nixos.org/"]; -} diff --git a/profiles/base/cachix/flox.nix b/profiles/base/cachix/flox.nix deleted file mode 100644 index baa1046..0000000 --- a/profiles/base/cachix/flox.nix +++ /dev/null @@ -1,13 +0,0 @@ - -{ - nix = { - settings = { - substituters = [ - "https://cache.flox.dev" # https://flox.dev/blog/flox-the-nix-foundation-and-nvidia-partner-for-cuda/ - ]; - trusted-public-keys = [ - "flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs=" - ]; - }; - }; -} diff --git a/profiles/base/cachix/nix-community.nix b/profiles/base/cachix/nix-community.nix deleted file mode 100644 index 7fc4c65..0000000 --- a/profiles/base/cachix/nix-community.nix +++ /dev/null @@ -1,13 +0,0 @@ - -{ - nix = { - settings = { - substituters = [ - "https://nix-community.cachix.org" - ]; - trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; - }; -} diff --git a/profiles/base/cachix/numtide.nix b/profiles/base/cachix/numtide.nix deleted file mode 100644 index 309a03b..0000000 --- a/profiles/base/cachix/numtide.nix +++ /dev/null @@ -1,13 +0,0 @@ - -{ - nix = { - settings = { - substituters = [ - "https://numtide.cachix.org" - ]; - trusted-public-keys = [ - "numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE=" - ]; - }; - }; -} diff --git a/profiles/base/default.nix b/profiles/base/default.nix index cbfb886..5a682f8 100644 --- a/profiles/base/default.nix +++ b/profiles/base/default.nix @@ -5,7 +5,7 @@ { imports = let ifExists = p: if builtins.pathExists p then p else {}; in [ ./../../secrets - ./cachix.nix # update with `nix run nixpkgs#cachix -- use --mode nixos -d . FOOBAR` + ./binary-caches.nix ./nix.nix # ./lix.nix ./locale-no.nix