nixos-configs/common/modules/cachix.nix

46 lines
1.7 KiB
Nix
Raw Normal View History

{
config,
2024-05-29 21:18:50 -04:00
lib,
pkgs,
...
2024-05-29 21:18:50 -04:00
}: let
2024-08-30 12:30:35 -04:00
inherit (lib) foldl isList mergeAttrsWithFunc optionals unique;
mergeAttrsList = list:
foldl (mergeAttrsWithFunc (a: b:
if isList a && isList b
then unique (a ++ b)
else b)) {}
list;
2024-05-29 21:18:50 -04:00
in {
2024-05-05 23:07:06 -04:00
environment.systemPackages = [
(pkgs.writeShellApplication {
name = "rebuild-no-cache";
2024-04-18 14:37:46 -04:00
runtimeInputs = [config.programs.nh.package];
text = ''
nh os switch -- --option binary-caches "https://cache.nixos.org" "$@"
'';
})
];
nix = {
2024-08-30 12:30:35 -04:00
settings = let
mkSubstituterConf = url: key: {
substituters = [url];
trusted-public-keys = optionals (key != null) [key];
};
in
mergeAttrsList ([
(mkSubstituterConf "https://cache.nixos.org" "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=")
(mkSubstituterConf "https://hyprland.cachix.org" "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=")
(mkSubstituterConf "https://nix-gaming.cachix.org" "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=")
(mkSubstituterConf "https://nixpkgs-wayland.cachix.org" "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA=")
(mkSubstituterConf "https://nix-community.cachix.org" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=")
(mkSubstituterConf "https://viperml.cachix.org" "viperml.cachix.org-1:qZhKBMTfmcLL+OG6fj/hzsMEedgKvZVFRRAhq7j8Vh8=")
]
2024-08-30 12:30:35 -04:00
++ optionals (!config.services.nix-serve.enable) [
(mkSubstituterConf "https://cache.nelim.org" "cache.nelim.org:JmFqkUdH11EA9EZOFAGVHuRYp7EbsdJDHvTQzG2pPyY=")
]);
};
}