aboutsummaryrefslogtreecommitdiffstats
path: root/hosts/common/core/nix.nix
blob: 2b77378af5a69daa59dcef0b9ba4f993400d0ade (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
36
37
38
39
{ inputs, lib, ... }:
{

  # work around very annoying TMPDIR handling
  # see: https://github.com/NixOS/nix/issues/7154
  boot.tmp.useTmpfs = true;
  systemd.services."nix-daemon".environment.TMPDIR = "/nix/tmp";
  systemd.tmpfiles.rules = [
    "d /nix/tmp 770 root nixbld"
  ];

  nix = {
    settings = {
      trusted-users = [ "root" "@wheel" ];

      auto-optimise-store = lib.mkDefault true;
      experimental-features = [ "nix-command" "flakes" "repl-flake" ];
      warn-dirty = false;
      #flake-registry = ""; # Disable global flake registry   This is a hold-over setting from Misterio77. Not sure significance but likely to do with nix.registry entry below.
    };

    # Add each flake input as a registry to make nix3 commands consistent with your flake
    #registry = lib.mapAttrs (_: value: { flake = value; }) inputs;

    # Add nixpkgs input to NIX_PATH
    # This lets nix2 commands still use <nixpkgs>
    #nixPath = [ "nixpkgs=${inputs.nixpkgs.outPath}" ];

    # Garbage Collection
    gc = {
      automatic = true;
      dates = "weekly";
      randomizedDelaySec = "14m";
      # Keep the last 2 generations
      options = "--delete-older-than 10";
    };

  };
}