flake-update-20260505
1{
2 config,
3 hostname,
4 inputs,
5 lib,
6 outputs,
7 ...
8}:
9{
10 imports = [
11 (./. + "/${hostname}/system.nix")
12
13 # ./common/base
14 ];
15
16 nixpkgs = {
17 # NOTE: Overlays might cause infinite recursion in system-manager
18 # Only apply them for NixOS systems
19 overlays = lib.optionals (!(config.system-manager.allowAnyDistro or false)) [
20 # Our own flake exports (from overlays and pkgs dir)
21 outputs.overlays.additions
22 outputs.overlays.modifications
23 outputs.overlays.unstable-packages
24
25 # And from other flakes
26 inputs.emacs-overlay.overlay
27 inputs.chapeau-rouge.overlays.openshift
28 inputs.chick-group.overlays.default
29 inputs.agenix.overlays.default
30
31 # Migrate to "modifications"
32 (_: prev: {
33 inherit (inputs.buildkit-tekton.packages.${prev.stdenv.hostPlatform.system}) tkn-local;
34 inherit (inputs.dagger.packages.${prev.stdenv.hostPlatform.system}) dagger;
35 })
36 ];
37 config = {
38 allowUnfree = true;
39 };
40 };
41 nix =
42 lib.optionalAttrs (!(config.system-manager.allowAnyDistro or false)) {
43 # This will add each flake input as a registry
44 # To make nix3 commands consistent with your flake
45 # NOTE: These options only exist in NixOS, not in system-manager
46 registry = lib.mkForce (lib.mapAttrs (_: value: { flake = value; }) inputs);
47
48 # This will additionally add your inputs to the system's legacy channels
49 # Making legacy nix commands consistent as well, awesome!
50 nixPath = lib.mkForce (
51 lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry
52 );
53 }
54 // lib.optionalAttrs (!(config.system-manager.allowAnyDistro or false)) {
55 # NOTE: optimise only exists in NixOS, not in system-manager
56 optimise = {
57 automatic = true;
58 dates = [
59 "01:10"
60 "12:10"
61 ];
62 };
63 }
64 // {
65
66 settings = {
67 auto-optimise-store = true;
68 experimental-features = [
69 "nix-command"
70 "flakes"
71 ];
72 sandbox = true;
73 allowed-users = [
74 "@wheel"
75 ];
76 trusted-users = [
77 "root"
78 "@wheel"
79 ];
80 # See https://nixos.org/manual/nix/stable/command-ref/conf-file#conf-use-xdg-base-directories
81 use-xdg-base-directories = true;
82
83 # Add some "caches" (substituters)
84 substituters = [
85 "https://cache.nixos.org/"
86 "https://r-ryantm.cachix.org"
87 "https://shortbrain.cachix.org"
88 "https://vdemeester.cachix.org"
89 "https://chapeau-rouge.cachix.org"
90 ];
91 trusted-public-keys = [
92 "r-ryantm.cachix.org-1:gkUbLkouDAyvBdpBX0JOdIiD2/DP1ldF3Z3Y6Gqcc4c="
93 "shortbrain.cachix.org-1:dqXcXzM0yXs3eo9ChmMfmob93eemwNyhTx7wCR4IjeQ="
94 "mic92.cachix.org-1:gi8IhgiT3CYZnJsaW7fxznzTkMUOn1RY4GmXdT/nXYQ="
95 "chapeau-rouge.cachix.org-1:r34IG766Ez4Eeanr7Zx+egzXLE2Zgvc+XRspYZPDAn8="
96 "vdemeester.cachix.org-1:eZWNOrLR9A9szeMahn9ENaoT9DB3WgOos8va+d2CU44="
97 ];
98 };
99
100 extraOptions = ''
101 connect-timeout = 20
102 build-cores = 0
103 keep-outputs = true
104 keep-derivations = true
105 builders-use-substitutes = true
106 '';
107 }
108 // lib.optionalAttrs (!(config.system-manager.allowAnyDistro or false)) {
109 # On laptops at least, make the daemon and builders low priority
110 # to have a responding system while building
111 # NOTE: These options only exist in NixOS, not in system-manager
112 daemonIOSchedClass = "idle";
113 daemonCPUSchedPolicy = "idle";
114 };
115}