summaryrefslogtreecommitdiff
path: root/nixos/hardware-configuration.nix
blob: f321cd05d200f828741d8cbcfd3700daf6c0b3ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
    ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];
  boot.supportedFilesystems = [ "ntfs" "btrfs" "vfat" ];
  # GRUB 2 with UEFI example, chainloading another distro
  boot.loader.grub.extraEntries = 
  ''
menuentry 'UEFI Firmware' $menuentry_id_option 'uefi-firmware' {
 fwsetup
}
  ''; 
  fileSystems."/" =
    { device = "/dev/disk/by-uuid/f75781bf-b2bf-4bb0-915d-95193e8eee9e";
      fsType = "btrfs";
      options = [ "noatime" "compress=zstd" "subvol=root" ];
    };

  fileSystems."/home" =
    { device = "/dev/disk/by-uuid/f75781bf-b2bf-4bb0-915d-95193e8eee9e";
      fsType = "btrfs";
      options = [ "noatime" "compress=zstd" "subvol=home" ];
    };

  fileSystems."/nix" =
    { device = "/dev/disk/by-uuid/f75781bf-b2bf-4bb0-915d-95193e8eee9e";
      fsType = "btrfs";
      options = [ "noatime" "compress=zstd" "subvol=nix" ];
    };

  fileSystems."/snapshots" =
    { device = "/dev/disk/by-uuid/f75781bf-b2bf-4bb0-915d-95193e8eee9e";
      fsType = "btrfs";
      options = [ "noatime" "compress=zstd" "subvol=snapshots" ];
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/6E1A-07F4";
      fsType = "vfat";
      options = [ "fmask=0077" "dmask=0077" ];
    };

  fileSystems."/store2" = 
    { device = "/dev/disk/by-uuid/5368282f-c09d-44cf-9cf2-e69a2d415da6";
      fsType = "btrfs";
      options = [ "noatime" "compress=zstd" "subvol=/"];
    };
  fileSystems."/store1" = 
    { device = "/dev/disk/by-uuid/6A2E2BFF2E2BC2C5";
      fsType = "ntfs-3g" ;
      options = ["rw" "uid=1000" "gid=100"];
    };
  fileSystems."/win_games" = 
    { device = "/dev/disk/by-uuid/6A680789680752ED";
      fsType = "ntfs-3g" ;
      options = ["rw" "uid=1000" "gid=100"];
    };
  


  swapDevices =
    [ { device = "/dev/disk/by-uuid/f1dfc6a1-55f3-4148-9f1d-2a998c3b3168"; }
      { device = "/dev/disk/by-uuid/003a819a-e06e-45df-bef6-b3702c2ddb48"; }
    ];

  # Thunderbolt 
  services.hardware.bolt.enable = true;
  powerManagement.enable = true; 

  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
  # (the default) this is the recommended approach. When using systemd-networkd it's
  # still possible to use this option, but it's recommended to use it in conjunction
  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
  # networking.nameservers = [ "1.1.1.1#one.one.one.one" "1.0.0.1#one.one.one.one" ];

	services.resolved = {
	  enable = true;
	  dnssec = "false";
	  domains = [ "~." ];
	  fallbackDns = [ ];
	  dnsovertls = "opportunistic";
	};

  
  networking.useDHCP = lib.mkDefault true;
  networking.firewall.checkReversePath = false;  

  # networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
  # networking.interfaces.enp81s0u1u4.useDHCP = lib.mkDefault true;
  # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;

   # Enable OpenGL
  hardware.graphics = {
    enable = true;
  };

  # Load nvidia driver for Xorg and Wayland
  services.xserver.videoDrivers = ["nvidia"];

  hardware.nvidia = {

    # Modesetting is required.
    modesetting.enable = true;

    # Nvidia power management. Experimental, and can cause sleep/suspend to fail.
    # Enable this if you have graphical corruption issues or application crashes after waking
    # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead 
    # of just the bare essentials.
    powerManagement.enable = false;

    # Fine-grained power management. Turns off GPU when not in use.
    # Experimental and only works on modern Nvidia GPUs (Turing or newer).
    powerManagement.finegrained = false;

    # Use the NVidia open source kernel module (not to be confused with the
    # independent third-party "nouveau" open source driver).
    # Support is limited to the Turing and later architectures. Full list of 
    # supported GPUs is at: 
    # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus 
    # Only available from driver 515.43.04+
    # Currently alpha-quality/buggy, so false is currently the recommended setting.
    open = false;

    # Enable the Nvidia settings menu,
	# accessible via `nvidia-settings`.
    nvidiaSettings = false;

    # Optionally, you may need to select the appropriate driver version for your specific GPU.
    package = config.boot.kernelPackages.nvidiaPackages.production;

    prime = {
        offload = {
			enable = true;
			enableOffloadCmd = true;
	};

	  sync.enable = false;

    intelBusId = "PCI:1:0:0";
    nvidiaBusId = "PCI:0:2:0";
    }; 
  };
}