feat: extract nvidia module and cleanup matej-nixos HW config
This commit is contained in:
@@ -23,6 +23,7 @@ in
|
|||||||
inputs.self.nixosModules.gnupg
|
inputs.self.nixosModules.gnupg
|
||||||
inputs.self.nixosModules.tuigreet
|
inputs.self.nixosModules.tuigreet
|
||||||
inputs.self.nixosModules.workstation
|
inputs.self.nixosModules.workstation
|
||||||
|
inputs.self.nixosModules.nvidia
|
||||||
];
|
];
|
||||||
|
|
||||||
# Modules
|
# Modules
|
||||||
@@ -43,6 +44,8 @@ in
|
|||||||
cmdFlags = [ "--unsupported-gpu" ];
|
cmdFlags = [ "--unsupported-gpu" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nvidia.enable = true;
|
||||||
|
|
||||||
# Stylix theming
|
# Stylix theming
|
||||||
stylix = {
|
stylix = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -87,6 +90,26 @@ in
|
|||||||
# Hardware
|
# Hardware
|
||||||
hardware.keyboard.zsa.enable = true;
|
hardware.keyboard.zsa.enable = true;
|
||||||
hardware.ledger.enable = true;
|
hardware.ledger.enable = true;
|
||||||
|
hardware.bluetooth.powerOnBoot = true;
|
||||||
|
|
||||||
|
# Networking
|
||||||
|
networking = {
|
||||||
|
hostName = "matej-nixos";
|
||||||
|
useDHCP = false;
|
||||||
|
networkmanager.enable = true;
|
||||||
|
interfaces.enp5s0.ipv4.addresses = [
|
||||||
|
{
|
||||||
|
address = "10.222.0.247";
|
||||||
|
prefixLength = 24;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
firewall.enable = false;
|
||||||
|
defaultGateway = "10.222.0.1";
|
||||||
|
nameservers = [
|
||||||
|
"1.1.1.1"
|
||||||
|
"8.8.8.8"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# XDG
|
# XDG
|
||||||
xdg.mime.defaultApplications = {
|
xdg.mime.defaultApplications = {
|
||||||
|
|||||||
@@ -75,76 +75,6 @@
|
|||||||
{ device = "/dev/disk/by-uuid/ff4750e7-3a9f-42c2-bb68-c458a6560540"; }
|
{ device = "/dev/disk/by-uuid/ff4750e7-3a9f-42c2-bb68-c458a6560540"; }
|
||||||
];
|
];
|
||||||
|
|
||||||
# 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 = {
|
|
||||||
useDHCP = false;
|
|
||||||
hostName = "matej-nixos";
|
|
||||||
networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
|
||||||
interfaces.enp5s0.ipv4.addresses = [
|
|
||||||
{
|
|
||||||
address = "10.222.0.247";
|
|
||||||
prefixLength = 24;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
firewall = {
|
|
||||||
enable = false;
|
|
||||||
allowedTCPPorts = lib.range 8800 8900;
|
|
||||||
};
|
|
||||||
defaultGateway = "10.222.0.1";
|
|
||||||
nameservers = [
|
|
||||||
"1.1.1.1"
|
|
||||||
"8.8.8.8"
|
|
||||||
];
|
|
||||||
|
|
||||||
};
|
|
||||||
# networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
|
||||||
# TODO: maybe move later
|
|
||||||
hardware.bluetooth.enable = true; # enables support for Bluetooth
|
|
||||||
hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot
|
|
||||||
|
|
||||||
# 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+
|
|
||||||
open = true;
|
|
||||||
|
|
||||||
# Enable the Nvidia settings menu,
|
|
||||||
# accessible via `nvidia-settings`.
|
|
||||||
nvidiaSettings = true;
|
|
||||||
|
|
||||||
# Optionally, you may need to select the appropriate driver version for your specific GPU.
|
|
||||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
23
modules/nixos/nvidia.nix
Normal file
23
modules/nixos/nvidia.nix
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
nvidia.enable = lib.mkEnableOption "NVIDIA GPU support";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.nvidia.enable {
|
||||||
|
hardware.graphics.enable = true;
|
||||||
|
|
||||||
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
|
|
||||||
|
hardware.nvidia = {
|
||||||
|
modesetting.enable = true;
|
||||||
|
open = true;
|
||||||
|
nvidiaSettings = true;
|
||||||
|
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user