summaryrefslogtreecommitdiff
path: root/os/common/modules/nix/default.nix
blob: bddf9789454c4637e554094899a48ade20b98745 (plain) (blame)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
  config,
  pkgs,
  determinate,
  lib,
  ...
}:
let
  user = config.global.userdata.name;

  nixWithFix = determinate.inputs.nix.packages.${pkgs.stdenv.system}.nix-everything.override {
    nix-cli = determinate.inputs.nix.packages.${pkgs.stdenv.system}.nix-cli.overrideAttrs (oldAttrs: {
      patches = (oldAttrs.patches or [ ]) ++ [
        ./nix.patch
      ];
    });
  };
in
{
  imports = [ determinate.nixosModules.default ];

  nix = {
    package = lib.mkForce nixWithFix;

    gc = {
      automatic = true;
      dates = "weekly";
      options = "--delete-older-than 30d";
    };

    settings = {
      auto-optimise-store = true;
      use-xdg-base-directories = true;
      trusted-users = [ user ];

      experimental-features = [
        "flakes"
        "nix-command"
      ];

      substituters = [
        "https://nixbin.sinanmohd.com"
        "https://nix-community.cachix.org"
      ];
      trusted-public-keys = [
        "nixbin.sinanmohd.com:dXV3KDPVrm+cGJ2M1ZmTeQJqFGaEapqiVoWHgYDh03k="
        "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      ];
    };
  };
}