grub + nvidia (kinda)
This commit is contained in:
@@ -1,23 +1,20 @@
|
||||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page, on
|
||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||
|
||||
{ config, lib, pkgs, user, allowed, secrets, rice, ... }:
|
||||
|
||||
{ config, lib, pkgs, user, allowed, secrets, rice, nvidia, ... }:
|
||||
let
|
||||
in
|
||||
{
|
||||
imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
./system-modules/hardware-configuration.nix
|
||||
./system-modules/users.nix
|
||||
./system-modules/sound.nix
|
||||
./system-modules/ollama.nix
|
||||
./system-modules/grub.nix
|
||||
./system-modules/dm.nix
|
||||
imports = [
|
||||
./system-modules/hardware-configuration.nix
|
||||
./system-modules/nvidia.nix # only does stuff if nvidia.enabled
|
||||
./system-modules/users.nix
|
||||
./system-modules/sound.nix
|
||||
./system-modules/grub.nix
|
||||
./system-modules/dm.nix
|
||||
|
||||
./system-modules/hsmw.nix
|
||||
./system-modules/health_reminder.nix
|
||||
./system-modules/davmail.nix
|
||||
./system-modules/docker.nix
|
||||
./system-modules/hsmw.nix
|
||||
./system-modules/docker.nix
|
||||
./system-modules/health_reminder.nix
|
||||
./system-modules/davmail.nix
|
||||
./system-modules/ollama.nix
|
||||
];
|
||||
|
||||
networking.hostName = "NxXPS";
|
||||
@@ -54,7 +51,7 @@
|
||||
services.xserver.libinput.enable = true;
|
||||
hardware.uinput.enable = true;
|
||||
|
||||
# log into this machine
|
||||
# log into this machine
|
||||
services.openssh.enable = false;
|
||||
|
||||
|
||||
@@ -62,6 +59,9 @@
|
||||
hardware.bluetooth.powerOnBoot = true; #
|
||||
services.blueman.enable = true;
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
# nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) allowed.unfree-packages;
|
||||
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
@@ -81,6 +81,7 @@
|
||||
direnv
|
||||
openssl
|
||||
blueman
|
||||
dmidecode
|
||||
];
|
||||
|
||||
fonts.packages = with pkgs; [
|
||||
@@ -90,7 +91,7 @@
|
||||
] ++ [
|
||||
rice.font.base.package
|
||||
rice.font.code.package
|
||||
]
|
||||
];
|
||||
|
||||
programs.gnupg.agent = {
|
||||
enable = true;
|
||||
@@ -98,7 +99,8 @@
|
||||
};
|
||||
|
||||
|
||||
programs.hyprland = { # config is done with home-manager
|
||||
programs.hyprland = {
|
||||
# config is done with home-manager
|
||||
enable = true;
|
||||
xwayland.enable = true;
|
||||
};
|
||||
|
||||
12
flake.lock
generated
12
flake.lock
generated
@@ -23,11 +23,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1711668574,
|
||||
"narHash": "sha256-u1dfs0ASQIEr1icTVrsKwg2xToIpn7ZXxW3RHfHxshg=",
|
||||
"lastModified": 1712168706,
|
||||
"narHash": "sha256-XP24tOobf6GGElMd0ux90FEBalUtw6NkBSVh/RlA6ik=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "219951b495fc2eac67b1456824cc1ec1fd2ee659",
|
||||
"rev": "1487bdea619e4a7a53a4590c475deabb5a9d1bfb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -38,11 +38,11 @@
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1711703276,
|
||||
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=",
|
||||
"lastModified": 1712163089,
|
||||
"narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089",
|
||||
"rev": "fd281bd6b7d3e32ddfa399853946f782553163b5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
138
flake.nix
138
flake.nix
@@ -9,69 +9,87 @@
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
user = "nx2";
|
||||
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
|
||||
allowed = {
|
||||
unfree-packages = [
|
||||
"spotify"
|
||||
"discord"
|
||||
"obsidian"
|
||||
"zoom-us"
|
||||
"zoom"
|
||||
"vscode-extension-ms-vscode-remote-remote-ssh"
|
||||
"vscode-extension-MS-python-vscode-pylance"
|
||||
];
|
||||
inecure-packages = [
|
||||
"electron-25.9.0"
|
||||
];
|
||||
};
|
||||
secrets = import ./secrets/passwords-and-certificates.nix;
|
||||
rice = {
|
||||
transparency = "0.8";
|
||||
colors = {
|
||||
main-fg = "#ffffff";
|
||||
main-bg = "#000000";
|
||||
bubble-fg = "#ffffff";
|
||||
bubble-bg = "#222222";
|
||||
bubble-border = "#bbbbbb";
|
||||
secondary-fg = "#ffffff";
|
||||
secondary-bg = "#222255";
|
||||
lines = "#bbbbbb";
|
||||
accent = "#ff00ff";
|
||||
};
|
||||
font = {
|
||||
code = {
|
||||
name = "CascadiaCove-NF";
|
||||
package = (pkgs.nerdfonts.override { fonts = [ "CascadiaCode" ]; });
|
||||
};
|
||||
base = {
|
||||
name = "Atkinson Hyperlegible";
|
||||
package = pkgs.atkinson-hyperlegible;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
nixosConfigurations = {
|
||||
NxXPS = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
./configuration.nix
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
|
||||
user = "nx2";
|
||||
|
||||
nvidia = rec {
|
||||
enable = true;
|
||||
prime = true;
|
||||
# unfree = if enable then [
|
||||
unfree = [
|
||||
"nvidia-x11"
|
||||
"nvidia-settings"
|
||||
"nvidia-persistenced"
|
||||
"cudatoolkit"
|
||||
"cudatoolkit-11.8.0"
|
||||
"cudatoolkit-12.2.2"
|
||||
];
|
||||
specialArgs = {inherit user allowed secrets rice;};
|
||||
# ] else [];
|
||||
};
|
||||
};
|
||||
allowed = {
|
||||
unfree-packages = [
|
||||
"spotify"
|
||||
"cudatoolkit-12.2.2"
|
||||
"discord"
|
||||
"obsidian"
|
||||
"zoom-us"
|
||||
"zoom"
|
||||
"vscode-extension-MS-python-vscode-pylance"
|
||||
] ++ nvidia.unfree ;
|
||||
|
||||
homeConfigurations = {
|
||||
nx2 = home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [ ./home.nix ];
|
||||
extraSpecialArgs = {inherit system user allowed secrets pkgs-unstable rice;};
|
||||
inecure-packages = [
|
||||
"electron-25.9.0"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
secrets = import ./secrets/passwords-and-certificates.nix;
|
||||
|
||||
rice = {
|
||||
transparency = "0.9";
|
||||
colors = rec {
|
||||
main-fg = "#ffffff";
|
||||
main-bg = "#000000";
|
||||
bubble-fg = main-fg;
|
||||
bubble-bg = "#222222";
|
||||
bubble-border = "#bbbbbb";
|
||||
secondary-fg = main-fg;
|
||||
secondary-bg = "#222255";
|
||||
lines = "#bbbbbb";
|
||||
accent = "#ff00ff";
|
||||
};
|
||||
font = {
|
||||
code = {
|
||||
name = "CascadiaCove-NF";
|
||||
package = (pkgs.nerdfonts.override { fonts = [ "CascadiaCode" ]; });
|
||||
};
|
||||
base = {
|
||||
name = "Atkinson Hyperlegible";
|
||||
package = pkgs.atkinson-hyperlegible;
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
nixosConfigurations = {
|
||||
NxXPS = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
./configuration.nix
|
||||
];
|
||||
specialArgs = { inherit user pkgs-unstable allowed secrets rice nvidia; };
|
||||
};
|
||||
};
|
||||
|
||||
homeConfigurations = {
|
||||
nx2 = home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [ ./home.nix ];
|
||||
extraSpecialArgs = { inherit system user allowed secrets pkgs-unstable rice nvidia; };
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,51 +1,54 @@
|
||||
# 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, user, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "vmd" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
# boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
# { device = "/dev/disk/by-uuid/9770465e-6b0e-40ec-944a-953fe71cf47a";
|
||||
{
|
||||
device = "/dev/disk/by-label/nixos";
|
||||
fsType = "ext4";
|
||||
};
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-label/nixos";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{
|
||||
device = "/dev/disk/by-label/EFI";
|
||||
fsType = "vfat";
|
||||
};
|
||||
fileSystems."/home/${user}/shared" =
|
||||
{
|
||||
device = "/dev/disk/by-label/shared";
|
||||
fsType = "ntfs";
|
||||
};
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-label/EFI";
|
||||
fsType = "vfat";
|
||||
};
|
||||
fileSystems."/home/${user}/shared" = {
|
||||
device = "/dev/disk/by-label/shared";
|
||||
fsType = "ntfs";
|
||||
};
|
||||
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/dev/disk/by-label/swap";
|
||||
# size = 16 * 1024;
|
||||
}
|
||||
{ device = "/dev/disk/by-label/swap"; }
|
||||
];
|
||||
|
||||
# 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 = 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;
|
||||
|
||||
# from nixos-hardware
|
||||
services.thermald.enable = lib.mkDefault true;
|
||||
boot.extraModprobeConfig = ''
|
||||
options iwlwifi 11n_disable=8
|
||||
'';
|
||||
boot.initrd.kernelModules = [ "i915" ];
|
||||
|
||||
environment.variables = {
|
||||
VDPAU_DRIVER = lib.mkIf config.hardware.opengl.enable (lib.mkDefault "va_gl");
|
||||
};
|
||||
|
||||
hardware.opengl.extraPackages = with pkgs; [
|
||||
(if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then vaapiIntel else intel-vaapi-driver)
|
||||
libvdpau-va-gl
|
||||
intel-media-driver
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
72
system-modules/nvidia.nix
Normal file
72
system-modules/nvidia.nix
Normal file
@@ -0,0 +1,72 @@
|
||||
{ config, pkgs, pkgs-unstable, lib, nvidia, ... }:
|
||||
let
|
||||
in
|
||||
{
|
||||
config = lib.mkIf nvidia.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
lshw
|
||||
nvtop
|
||||
glxinfo
|
||||
(pkgs.writeShellScriptBin "nvidia-offload" ''
|
||||
export __NV_PRIME_RENDER_OFFLOAD=1
|
||||
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
|
||||
export __GLX_VENDOR_LIBRARY_NAME=nvidia
|
||||
export __VK_LAYER_NV_optimus=NVIDIA_only
|
||||
exec "$@"
|
||||
'')
|
||||
] ++ [
|
||||
# pkgs-unstable.nvtopPackages.intel
|
||||
# pkgs-unstable.nvtopPackages.nvidia
|
||||
];
|
||||
|
||||
# Load nvidia driver for Xorg and Wayland
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
|
||||
hardware = {
|
||||
nvidia = {
|
||||
prime = lib.mkIf nvidia.prime {
|
||||
intelBusId = "PCI:0:2:0";
|
||||
nvidiaBusId = "PCI:1:0:0";
|
||||
offload = {
|
||||
enable = true;
|
||||
enableOffloadCmd = true;
|
||||
};
|
||||
};
|
||||
modesetting.enable = true;
|
||||
|
||||
# Modesetting is required.
|
||||
|
||||
# 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 = true;
|
||||
|
||||
# Fine-grained power management. Turns off GPU when not in use.
|
||||
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
|
||||
powerManagement.finegrained = true;
|
||||
|
||||
# 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 = true;
|
||||
|
||||
# Optionally, you may need to select the appropriate driver version for your specific GPU.
|
||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
};
|
||||
opengl = {
|
||||
enable = true;
|
||||
driSupport = true;
|
||||
driSupport32Bit = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user