grub + nvidia (kinda)
This commit is contained in:
@@ -1,23 +1,20 @@
|
|||||||
# Edit this configuration file to define what should be installed on
|
{ config, lib, pkgs, user, allowed, secrets, rice, nvidia, ... }:
|
||||||
# your system. Help is available in the configuration.nix(5) man page, on
|
let
|
||||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
in
|
||||||
|
|
||||||
{ config, lib, pkgs, user, allowed, secrets, rice, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
imports =
|
imports = [
|
||||||
[ # Include the results of the hardware scan.
|
./system-modules/hardware-configuration.nix
|
||||||
./system-modules/hardware-configuration.nix
|
./system-modules/nvidia.nix # only does stuff if nvidia.enabled
|
||||||
./system-modules/users.nix
|
./system-modules/users.nix
|
||||||
./system-modules/sound.nix
|
./system-modules/sound.nix
|
||||||
./system-modules/ollama.nix
|
./system-modules/grub.nix
|
||||||
./system-modules/grub.nix
|
./system-modules/dm.nix
|
||||||
./system-modules/dm.nix
|
|
||||||
|
|
||||||
./system-modules/hsmw.nix
|
./system-modules/hsmw.nix
|
||||||
./system-modules/health_reminder.nix
|
./system-modules/docker.nix
|
||||||
./system-modules/davmail.nix
|
./system-modules/health_reminder.nix
|
||||||
./system-modules/docker.nix
|
./system-modules/davmail.nix
|
||||||
|
./system-modules/ollama.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
networking.hostName = "NxXPS";
|
networking.hostName = "NxXPS";
|
||||||
@@ -54,7 +51,7 @@
|
|||||||
services.xserver.libinput.enable = true;
|
services.xserver.libinput.enable = true;
|
||||||
hardware.uinput.enable = true;
|
hardware.uinput.enable = true;
|
||||||
|
|
||||||
# log into this machine
|
# log into this machine
|
||||||
services.openssh.enable = false;
|
services.openssh.enable = false;
|
||||||
|
|
||||||
|
|
||||||
@@ -62,6 +59,9 @@
|
|||||||
hardware.bluetooth.powerOnBoot = true; #
|
hardware.bluetooth.powerOnBoot = true; #
|
||||||
services.blueman.enable = 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:
|
# List packages installed in system profile. To search, run:
|
||||||
# $ nix search wget
|
# $ nix search wget
|
||||||
@@ -81,6 +81,7 @@
|
|||||||
direnv
|
direnv
|
||||||
openssl
|
openssl
|
||||||
blueman
|
blueman
|
||||||
|
dmidecode
|
||||||
];
|
];
|
||||||
|
|
||||||
fonts.packages = with pkgs; [
|
fonts.packages = with pkgs; [
|
||||||
@@ -90,7 +91,7 @@
|
|||||||
] ++ [
|
] ++ [
|
||||||
rice.font.base.package
|
rice.font.base.package
|
||||||
rice.font.code.package
|
rice.font.code.package
|
||||||
]
|
];
|
||||||
|
|
||||||
programs.gnupg.agent = {
|
programs.gnupg.agent = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -98,7 +99,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
programs.hyprland = { # config is done with home-manager
|
programs.hyprland = {
|
||||||
|
# config is done with home-manager
|
||||||
enable = true;
|
enable = true;
|
||||||
xwayland.enable = true;
|
xwayland.enable = true;
|
||||||
};
|
};
|
||||||
|
|||||||
12
flake.lock
generated
12
flake.lock
generated
@@ -23,11 +23,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1711668574,
|
"lastModified": 1712168706,
|
||||||
"narHash": "sha256-u1dfs0ASQIEr1icTVrsKwg2xToIpn7ZXxW3RHfHxshg=",
|
"narHash": "sha256-XP24tOobf6GGElMd0ux90FEBalUtw6NkBSVh/RlA6ik=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "219951b495fc2eac67b1456824cc1ec1fd2ee659",
|
"rev": "1487bdea619e4a7a53a4590c475deabb5a9d1bfb",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -38,11 +38,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-unstable": {
|
"nixpkgs-unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1711703276,
|
"lastModified": 1712163089,
|
||||||
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=",
|
"narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089",
|
"rev": "fd281bd6b7d3e32ddfa399853946f782553163b5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
138
flake.nix
138
flake.nix
@@ -9,69 +9,87 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, ... }:
|
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, ... }:
|
||||||
let
|
let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
user = "nx2";
|
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
|
||||||
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
|
user = "nx2";
|
||||||
allowed = {
|
|
||||||
unfree-packages = [
|
nvidia = rec {
|
||||||
"spotify"
|
enable = true;
|
||||||
"discord"
|
prime = true;
|
||||||
"obsidian"
|
# unfree = if enable then [
|
||||||
"zoom-us"
|
unfree = [
|
||||||
"zoom"
|
"nvidia-x11"
|
||||||
"vscode-extension-ms-vscode-remote-remote-ssh"
|
"nvidia-settings"
|
||||||
"vscode-extension-MS-python-vscode-pylance"
|
"nvidia-persistenced"
|
||||||
];
|
"cudatoolkit"
|
||||||
inecure-packages = [
|
"cudatoolkit-11.8.0"
|
||||||
"electron-25.9.0"
|
"cudatoolkit-12.2.2"
|
||||||
];
|
|
||||||
};
|
|
||||||
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
|
|
||||||
];
|
];
|
||||||
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 = {
|
inecure-packages = [
|
||||||
nx2 = home-manager.lib.homeManagerConfiguration {
|
"electron-25.9.0"
|
||||||
inherit pkgs;
|
];
|
||||||
modules = [ ./home.nix ];
|
|
||||||
extraSpecialArgs = {inherit system user allowed secrets pkgs-unstable rice;};
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
};
|
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, ... }:
|
{ config, lib, user, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports =
|
imports = [
|
||||||
[
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
];
|
||||||
];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "vmd" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
|
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.kernelModules = [ "kvm-intel" ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
fileSystems."/" =
|
fileSystems."/" = {
|
||||||
# { device = "/dev/disk/by-uuid/9770465e-6b0e-40ec-944a-953fe71cf47a";
|
device = "/dev/disk/by-label/nixos";
|
||||||
{
|
fsType = "ext4";
|
||||||
device = "/dev/disk/by-label/nixos";
|
};
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/boot" =
|
fileSystems."/boot" = {
|
||||||
{
|
device = "/dev/disk/by-label/EFI";
|
||||||
device = "/dev/disk/by-label/EFI";
|
fsType = "vfat";
|
||||||
fsType = "vfat";
|
};
|
||||||
};
|
fileSystems."/home/${user}/shared" = {
|
||||||
fileSystems."/home/${user}/shared" =
|
device = "/dev/disk/by-label/shared";
|
||||||
{
|
fsType = "ntfs";
|
||||||
device = "/dev/disk/by-label/shared";
|
};
|
||||||
fsType = "ntfs";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices = [
|
swapDevices = [
|
||||||
{
|
{ device = "/dev/disk/by-label/swap"; }
|
||||||
device = "/dev/disk/by-label/swap";
|
|
||||||
# size = 16 * 1024;
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# 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.useDHCP = lib.mkDefault true;
|
||||||
# networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
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