summary refs log tree commit diff
path: root/modules/nix.nix
blob: a98ec1882dcf3ba210b9cbddd7fcde93810c7983 (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
32
33
34
35
{ me, lib, self, ... }:

let
  # NOTE: disable te bismuth cache for now,
  # when bismuth is offline it still hangs,
  # maybe use corsac and let bismuth write to it?
  #useBismuthCache = (me != "bismuth");
  useBismuthCache = false;

  # 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 useBismuthCache bismuthCacheSettings; # use bismuth cache
  };
}