mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[Nix] Add option to add custom nix cache
This commit is contained in:
parent
a2c29a7c84
commit
e05ab538c3
1 changed files with 7 additions and 2 deletions
9
nix.nix
9
nix.nix
|
|
@ -2,10 +2,15 @@
|
||||||
with lib;
|
with lib;
|
||||||
with myLib;
|
with myLib;
|
||||||
let
|
let
|
||||||
|
cfg = config.aviallon.nix;
|
||||||
generalCfg = config.aviallon.general;
|
generalCfg = config.aviallon.general;
|
||||||
desktopCfg = config.aviallon.desktop;
|
desktopCfg = config.aviallon.desktop;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
options.aviallon.nix = {
|
||||||
|
enableCustomSubstituter = mkEnableOption "custom substituter using nix-cache.lesviallon.fr";
|
||||||
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
||||||
system.autoUpgrade.enable = mkDefault true;
|
system.autoUpgrade.enable = mkDefault true;
|
||||||
|
|
@ -34,8 +39,8 @@ in
|
||||||
stalled-download-timeout = 20;
|
stalled-download-timeout = 20;
|
||||||
};
|
};
|
||||||
|
|
||||||
nix.binaryCaches = mkBefore [ "https://nix-cache.lesviallon.fr" ];
|
nix.binaryCaches = mkIf cfg.enableCustomSubstituter (mkBefore [ "https://nix-cache.lesviallon.fr" ]);
|
||||||
nix.binaryCachePublicKeys = mkBefore [ "nix-cache.lesviallon.fr-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ];
|
nix.binaryCachePublicKeys = mkIf cfg.enableCustomSubstituter (mkBefore [ "nix-cache.lesviallon.fr-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ]);
|
||||||
|
|
||||||
nix.buildCores = mkIf (generalCfg.cores != null) generalCfg.cores;
|
nix.buildCores = mkIf (generalCfg.cores != null) generalCfg.cores;
|
||||||
nix.maxJobs = mkIf (generalCfg.cores != null) (math.log2 generalCfg.cores);
|
nix.maxJobs = mkIf (generalCfg.cores != null) (math.log2 generalCfg.cores);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue