All my system configs and packages in one repo
1# Common configs for all machines.
2{
3 config,
4 inputs,
5 ...
6}:
7{
8 imports = [
9 inputs.nixos-generators.nixosModules.all-formats
10 ];
11
12 system.stateVersion = "25.05";
13
14 nix = {
15 # Add `n` as an alias of `nixpkgs`
16 registry.n.to = {
17 type = "path";
18 path = config.nixpkgs.flake.source;
19 };
20
21 gc = {
22 automatic = true;
23 dates = "weekly";
24 options = "--delete-older-than 7d";
25 };
26
27 settings = {
28 auto-optimise-store = true;
29 experimental-features = [
30 "nix-command"
31 "flakes"
32 "auto-allocate-uids"
33 "configurable-impure-env"
34 ];
35 trusted-users = [ "@wheel" ];
36 };
37 };
38
39 nixpkgs = {
40 # I'm not part of the FSF and I don't care
41 config.allowUnfree = true;
42 flake.setNixPath = true;
43
44 overlays = [ inputs.self.overlays.default ];
45 };
46
47 boot.tmp = {
48 cleanOnBoot = true;
49 useTmpfs = true;
50 };
51
52 # Make Nix use /var/tmp for building, so that
53 # large files don't have to live in tmpfs
54 systemd.services.nix-daemon.environment.TMPDIR = "/var/tmp";
55
56 # Use dbus-broker for higher D-Bus performance
57 services.dbus.implementation = "broker";
58
59 # This is very bizarre.
60 #
61 # Within the Tangled CI environment there's no user information at all,
62 # and the builder is ran with ID 0. This is a problem because logrotate's
63 # check script apparently assumes the `id` binary will always succeed.
64 # Given that I don't want to mess with logrotate at all beyond what is
65 # already given to me as a default, I think it's saner to just disable
66 # config validation to make CI pass.
67 services.logrotate.checkConfig = false;
68
69 zramSwap = {
70 enable = true;
71 algorithm = "zstd";
72 };
73
74 # Disable DualSense/DualShock 4 touchpad acting as mouse
75 # See https://wiki.archlinux.org/title/Gamepad#Disable_touchpad_acting_as_mouse
76 services.udev.extraRules = ''
77 # USB
78 ATTRS{name}=="Sony Interactive Entertainment Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1"
79 # Bluetooth
80 ATTRS{name}=="Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1"
81 '';
82
83 # Fix the pairing process with a DualSense controller
84 hardware.bluetooth.settings = {
85 General.UserspaceHID = false;
86 };
87
88 system.configurationRevision = inputs.self.rev or inputs.self.dirtyRev or "unknown-dirty";
89}