dot

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

146 lines2658 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) ];
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, such as the CachyOS kernel's.
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 description = "Gustaf Granström";
91 shell = pkgs.zsh;
92 extraGroups = [
93 "wheel"
94 "networkmanager"
95 "video"
96 "audio"
97 "input"
98 "lp"
99 # Claude Desktop's Cowork VM needs /dev/kvm and /dev/vhost-vsock.
100 "kvm"
101 ];
102 };
103 programs.zsh.enable = true;
104
105 environment.systemPackages = with pkgs; [
106 git
107 gh
108 wget
109 curl
110 rsync
111 unzip
112 unrar
113 pv
114 less
115 file
116 which
117 vim
118 nano
119 micro
120 neovim
121 tmux
122 btop
123 duf
124 glances
125 fastfetch
126 ripgrep
127 fd
128 jq
129 yq-go
130 usbutils
131 pciutils
132 lsof
133 dmidecode
134 hwinfo
135 smartmontools
136 hdparm
137 ethtool
138 btrfs-progs
139 compsize
140 exfatprogs
141 dosfstools
142 ntfs3g
143 efibootmgr
144 man-pages
145 ];
146}