dot

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

75 lines1905 bytesNix
1# Written by hand from the CachyOS install, in the shape nixos-generate-config
2# produces. During the install, compare it with the output of
3# nixos-generate-config --show-hardware-config --root /mnt
4# and keep the generated one if they differ.
5#
6# Disk layout: the existing btrfs partition is kept. NixOS gets subvolumes of
7# its own (@nixos for /, @nix for /nix, @nixos-log for /var/log) next to
8# CachyOS's, and /home is CachyOS's @home, so your files stay where they are.
9# See MIGRATION.md.
10{
11 config,
12 lib,
13 modulesPath,
14 ...
15}:
16let
17 btrfs = "/dev/disk/by-uuid/6e57f546-3dd3-43f6-9d1b-1c57f3b489ad";
18 subvol = name: [
19 "subvol=${name}"
20 "noatime"
21 "compress=zstd"
22 ];
23in
24{
25 imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
26
27 boot.initrd.availableKernelModules = [
28 "nvme"
29 "xhci_pci"
30 "ahci"
31 "usbhid"
32 "usb_storage"
33 "sd_mod"
34 ];
35 boot.kernelModules = [ "kvm-amd" ];
36
37 fileSystems."/" = {
38 device = btrfs;
39 fsType = "btrfs";
40 options = subvol "@nixos";
41 };
42 fileSystems."/nix" = {
43 device = btrfs;
44 fsType = "btrfs";
45 options = subvol "@nix";
46 };
47 fileSystems."/var/log" = {
48 device = btrfs;
49 fsType = "btrfs";
50 options = subvol "@nixos-log";
51 neededForBoot = true;
52 };
53 fileSystems."/home" = {
54 device = btrfs;
55 fsType = "btrfs";
56 options = subvol "@home";
57 };
58 fileSystems."/boot" = {
59 device = "/dev/disk/by-uuid/DDCE-5209";
60 fsType = "vfat";
61 options = [
62 "fmask=0077"
63 "dmask=0077"
64 ];
65 };
66
67 # The second drive (sdb, ext4) was commented out in CachyOS's fstab too.
68 # fileSystems."/home/vizie/Games" = {
69 # device = "/dev/disk/by-uuid/deadbeef-b2a7-406c-9704-4d07e2f38996";
70 # fsType = "ext4";
71 # };
72
73 hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
74 nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
75}