[Nix] Add option to add custom nix cache

This commit is contained in:
Antoine Viallon 2022-10-07 22:49:20 +02:00
parent a2c29a7c84
commit e05ab538c3
Signed by: aviallon
GPG key ID: 186FC35EDEB25716

View file

@ -2,10 +2,15 @@
with lib;
with myLib;
let
cfg = config.aviallon.nix;
generalCfg = config.aviallon.general;
desktopCfg = config.aviallon.desktop;
in
{
options.aviallon.nix = {
enableCustomSubstituter = mkEnableOption "custom substituter using nix-cache.lesviallon.fr";
};
config = {
system.autoUpgrade.enable = mkDefault true;
@ -34,8 +39,8 @@ in
stalled-download-timeout = 20;
};
nix.binaryCaches = mkBefore [ "https://nix-cache.lesviallon.fr" ];
nix.binaryCachePublicKeys = mkBefore [ "nix-cache.lesviallon.fr-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ];
nix.binaryCaches = mkIf cfg.enableCustomSubstituter (mkBefore [ "https://nix-cache.lesviallon.fr" ]);
nix.binaryCachePublicKeys = mkIf cfg.enableCustomSubstituter (mkBefore [ "nix-cache.lesviallon.fr-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ]);
nix.buildCores = mkIf (generalCfg.cores != null) generalCfg.cores;
nix.maxJobs = mkIf (generalCfg.cores != null) (math.log2 generalCfg.cores);