flake-update-20260505
 1{
 2  config,
 3  hostname,
 4  inputs,
 5  lib,
 6  stateVersion,
 7  ...
 8}:
 9{
10  imports = [
11    (./. + "/${hostname}/boot.nix")
12    (./. + "/${hostname}/hardware.nix")
13  ]
14  ++ lib.optional (builtins.pathExists (./. + "/${hostname}/extra.nix")) ./${hostname}/extra.nix;
15
16  nixpkgs.config.allowUnfree = true;
17
18  nix = {
19
20    # This will add each flake input as a registry
21    # To make nix3 commands consistent with your flake
22    registry = lib.mkForce (lib.mapAttrs (_: value: { flake = value; }) inputs);
23
24    # This will additionally add your inputs to the system's legacy channels
25    # Making legacy nix commands consistent as well, awesome!
26    nixPath = lib.mkForce (
27      lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry
28    );
29
30    optimise = {
31      automatic = true;
32      dates = [
33        "01:10"
34        "12:10"
35      ];
36    };
37
38    settings = {
39      auto-optimise-store = true;
40      experimental-features = [
41        "nix-command"
42        "flakes"
43      ];
44      sandbox = true;
45      allowed-users = [
46        "@wheel"
47      ];
48      trusted-users = [
49        "root"
50        "@wheel"
51      ];
52      # See https://nixos.org/manual/nix/stable/command-ref/conf-file#conf-use-xdg-base-directories
53      use-xdg-base-directories = true;
54
55      # Add some "caches" (substituters)
56      substituters = [
57        "https://cache.nixos.org/"
58        "https://r-ryantm.cachix.org"
59        "https://shortbrain.cachix.org"
60        "https://vdemeester.cachix.org"
61        "https://chapeau-rouge.cachix.org"
62        "https://nixos-raspberrypi.cachix.org"
63      ];
64      trusted-public-keys = [
65        "r-ryantm.cachix.org-1:gkUbLkouDAyvBdpBX0JOdIiD2/DP1ldF3Z3Y6Gqcc4c="
66        "shortbrain.cachix.org-1:dqXcXzM0yXs3eo9ChmMfmob93eemwNyhTx7wCR4IjeQ="
67        "chapeau-rouge.cachix.org-1:r34IG766Ez4Eeanr7Zx+egzXLE2Zgvc+XRspYZPDAn8="
68        "vdemeester.cachix.org-1:eZWNOrLR9A9szeMahn9ENaoT9DB3WgOos8va+d2CU44="
69        "nixos-raspberrypi.cachix.org-1:4iMO9LXa8BqhU+Rpg6LQKiGa2lsNh/j2oiYLNOQ5sPI="
70      ];
71    };
72
73    extraOptions = ''
74      connect-timeout = 20
75      build-cores = 0
76      keep-outputs = true
77      keep-derivations = true
78      builders-use-substitutes = true
79    '';
80
81    # On laptops at least, make the daemon and builders low priority
82    # to have a responding system while building
83    daemonIOSchedClass = "idle";
84    daemonCPUSchedPolicy = "idle";
85  };
86
87  # `nix-daemon` will hit the stack limit when using `nixFlakes`.
88  systemd.services.nix-daemon.serviceConfig."LimitSTACK" = "infinity";
89
90  system = {
91    inherit stateVersion;
92  };
93}