blob: 551ab981f758c8f9a04a1a6ef115de80351ca9d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.modules.binary-cache;
folder = ./caches;
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;
options.modules.binary-cache = {
enable = mkEnableOption "binary-cache";
};
config = mkIf cfg.enable {
nix.settings.substituters = [ "https://cache.nixos.org/" ];
environment.systemPackages = [ pkgs.cachix ];
};
}
|