dot

vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks

149 lines2766 bytesNix
1# Nix itself, boot, locale, network and the user account.
2{
3 inputs,
4 pkgs,
5 ...
6}:
7{
8 nixpkgs = {
9 config.allowUnfree = true;
10 overlays = [ (import ../../pkgs inputs) ];
11 };
12
13 nix = {
14 settings = {
15 experimental-features = [
16 "nix-command"
17 "flakes"
18 ];
19 # Lets you (as a wheel member, who can sudo anyway) use the binary caches
20 # flakes ask for.
21 trusted-users = [
22 "root"
23 "@wheel"
24 ];
25 auto-optimise-store = true;
26 };
27 gc = {
28 automatic = true;
29 dates = "weekly";
30 options = "--delete-older-than 14d";
31 };
32 # `nix shell nixpkgs#foo` uses the same nixpkgs as the system.
33 registry.nixpkgs.flake = inputs.nixpkgs;
34 nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
35 };
36
37 boot = {
38 loader = {
39 systemd-boot = {
40 enable = true;
41 configurationLimit = 10;
42 };
43 efi.canTouchEfiVariables = true;
44 timeout = 3;
45 };
46 initrd.systemd.enable = true;
47 plymouth.enable = true;
48 kernelParams = [
49 "quiet"
50 "splash"
51 ];
52 tmp.useTmpfs = true;
53 };
54
55 zramSwap = {
56 enable = true;
57 algorithm = "zstd";
58 memoryPercent = 100;
59 priority = 100;
60 };
61
62 time.timeZone = "Europe/Oslo";
63 i18n.defaultLocale = "en_US.UTF-8";
64 console.keyMap = "no";
65
66 networking = {
67 networkmanager.enable = true;
68 # CachyOS: /etc/sysctl.d/99-disable-ipv6.conf
69 enableIPv6 = false;
70 # ufw on CachyOS: drop incoming except SSH.
71 firewall = {
72 enable = true;
73 allowedTCPPorts = [ 22 ];
74 };
75 };
76 services.resolved.enable = true;
77
78 services.avahi = {
79 enable = true;
80 nssmdns4 = true;
81 # ufw kept port 5353 closed on CachyOS too.
82 openFirewall = false;
83 };
84
85 services.openssh.enable = true;
86 services.fstrim.enable = true;
87
88 users.users.vizie = {
89 isNormalUser = true;
90 # The same uid as on CachyOS, so the home folder restored from the backup
91 # (MIGRATION.md) belongs to you.
92 uid = 1000;
93 description = "Gustaf Granström";
94 shell = pkgs.zsh;
95 extraGroups = [
96 "wheel"
97 "networkmanager"
98 "video"
99 "audio"
100 "input"
101 "lp"
102 # Claude Desktop's Cowork VM needs /dev/kvm and /dev/vhost-vsock.
103 "kvm"
104 ];
105 };
106 programs.zsh.enable = true;
107
108 environment.systemPackages = with pkgs; [
109 git
110 gh
111 wget
112 curl
113 rsync
114 unzip
115 unrar
116 pv
117 less
118 file
119 which
120 vim
121 nano
122 micro
123 neovim
124 tmux
125 btop
126 duf
127 glances
128 fastfetch
129 ripgrep
130 fd
131 jq
132 yq-go
133 usbutils
134 pciutils
135 lsof
136 dmidecode
137 hwinfo
138 smartmontools
139 hdparm
140 ethtool
141 btrfs-progs
142 compsize
143 exfatprogs
144 dosfstools
145 ntfs3g
146 efibootmgr
147 man-pages
148 ];
149}