summary refs log tree commit diff
path: root/modules/nix.nix
blob: 4d8109e1a50b5e31a016f7dad411c1d1cbbd2d18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{ me, lib, self, ... }:

let
  imNotBismuth = (me != "bismuth");
  
  # nixos by default likes to place the default cache
  # at the end, but bismuth is often offline, and the
  # default cache should be preferred if it has the
  # necessary derivation
  mkPostfix = x: lib.mkOrder 2000 x;

  bismuthCacheSettings = { 
    substituters = mkPostfix [ "http://bismuth.serval-moth.ts.net:5000" ];
    trusted-public-keys = [ "bismuth-1:XW9nsNsccipbmdfchyb3YIIWNT058iSpHLwlj1xgB7A=" ];
  };

in
{
  nix = {
    # add compat scripts to the environment,
    # to allow nixos-option to find the configuration
    nixPath = [
      "nixpkgs=${self}/compat"
      "nixos-config=${self}/compat/nixos"
    ];

    settings = {
      experimental-features = [ "flakes" "nix-command" ];
    } // lib.optionalAttrs imNotBismuth bismuthCacheSettings; # use bismuth cache
  };
}