From 8ea9debb5a070ed0fccd30f3cd29018f7c7c2a8e Mon Sep 17 00:00:00 2001 From: matt1432 Date: Tue, 17 Oct 2023 17:53:10 -0400 Subject: [PATCH] feat(binto): add nvidia.nix and move some hm stuff to modules --- common/default.nix | 5 ++ hosts/binto/binto.nix | 23 ------- hosts/binto/configuration.nix | 65 +++++++++++-------- hosts/binto/hardware-configuration.nix | 8 ++- hosts/binto/modules/nvidia.nix | 40 ++++++++++++ hosts/wim/home/main.nix | 5 +- {hosts/wim/home => modules}/dconf.nix | 2 + .../firefox/addons/addons.json | 0 .../firefox/addons/default.nix | 0 .../addons/generated-firefox-addons.nix | 0 .../wim/home => modules}/firefox/custom.css | 0 .../home => modules}/firefox/firefox-gx.nix | 0 {hosts/wim/home => modules}/firefox/main.nix | 0 13 files changed, 96 insertions(+), 52 deletions(-) delete mode 100644 hosts/binto/binto.nix create mode 100644 hosts/binto/modules/nvidia.nix rename {hosts/wim/home => modules}/dconf.nix (94%) rename {hosts/wim/home => modules}/firefox/addons/addons.json (100%) rename {hosts/wim/home => modules}/firefox/addons/default.nix (100%) rename {hosts/wim/home => modules}/firefox/addons/generated-firefox-addons.nix (100%) rename {hosts/wim/home => modules}/firefox/custom.css (100%) rename {hosts/wim/home => modules}/firefox/firefox-gx.nix (100%) rename {hosts/wim/home => modules}/firefox/main.nix (100%) diff --git a/common/default.nix b/common/default.nix index 52e55366..e7236fa2 100644 --- a/common/default.nix +++ b/common/default.nix @@ -26,6 +26,11 @@ }; }; + services.xserver = { + layout = "ca"; + xkbVariant = "multix"; + }; + home-manager.users = let default = { imports = [ diff --git a/hosts/binto/binto.nix b/hosts/binto/binto.nix deleted file mode 100644 index d4b1d985..00000000 --- a/hosts/binto/binto.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ ... }: - -{ - users.users.matt = { - isNormalUser = true; - extraGroups = [ "wheel" "input" "uinput" "adm" "mlocate" "video" "libvirtd" ]; - }; - - programs.dconf.enable = true; - - # TODO: use hm for tmux - home-manager.users = { - matt = { - - imports = [ - ../wim/home/dconf.nix - ../wim/home/firefox/main.nix - ]; - - home.stateVersion = "23.11"; - }; - }; -} diff --git a/hosts/binto/configuration.nix b/hosts/binto/configuration.nix index d4b9089b..9ae922bb 100644 --- a/hosts/binto/configuration.nix +++ b/hosts/binto/configuration.nix @@ -10,13 +10,9 @@ ../../modules/kmscon.nix ../../modules/printer.nix - ./binto.nix + ./modules/nvidia.nix ]; - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.supportedFilesystems = [ "ntfs" ]; - networking = { hostName = "binto"; networkmanager.enable = true; @@ -27,32 +23,49 @@ time.timeZone = "America/Toronto"; # Enable the X11 windowing system. - services.xserver.enable = true; - - # Enable the KDE Plasma Desktop Environment. - services.xserver.displayManager.sddm.enable = true; - services.xserver.desktopManager.plasma5.enable = true; - - # Configure keymap in X11 services.xserver = { - layout = "ca"; - xkbVariant = "multix"; + enable = true; + + # Enable the KDE Plasma Desktop Environment. + displayManager.sddm.enable = true; + desktopManager.plasma5.enable = true; }; - services.tailscale = { - enable = true; - extraUpFlags = [ - "--login-server https://headscale.nelim.org" - "--operator=matt" - ]; + services = { + tailscale = { + enable = true; + extraUpFlags = [ + "--login-server https://headscale.nelim.org" + "--operator=matt" + ]; + }; + + openssh = { + enable = true; + settings = { + PasswordAuthentication = false; + PermitRootLogin = "no"; + }; + }; }; - # Enable the OpenSSH daemon. - services.openssh = { - enable = true; - settings = { - PasswordAuthentication = false; - PermitRootLogin = "no"; + users.users.matt = { + isNormalUser = true; + extraGroups = [ "wheel" "input" "uinput" "adm" "mlocate" "video" "libvirtd" ]; + }; + + programs.dconf.enable = true; + + # TODO: use hm for tmux + home-manager.users = { + matt = { + + imports = [ + ../../modules/dconf.nix + ../../modules/firefox/main.nix + ]; + + home.stateVersion = "23.11"; }; }; diff --git a/hosts/binto/hardware-configuration.nix b/hosts/binto/hardware-configuration.nix index af424088..93dea880 100644 --- a/hosts/binto/hardware-configuration.nix +++ b/hosts/binto/hardware-configuration.nix @@ -1,13 +1,19 @@ # 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, modulesPath, ... }: +{ config, lib, modulesPath, pkgs, ... }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.supportedFilesystems = [ "ntfs" ]; + + boot.kernelPackages = pkgs.linuxPackages_latest; boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; diff --git a/hosts/binto/modules/nvidia.nix b/hosts/binto/modules/nvidia.nix new file mode 100644 index 00000000..a81edd81 --- /dev/null +++ b/hosts/binto/modules/nvidia.nix @@ -0,0 +1,40 @@ +{ config, ... }: +{ + # Enable OpenGL + hardware.opengl = { + enable = true; + driSupport = true; + driSupport32Bit = 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. + 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+ + # Do not disable this unless your GPU is unsupported or if you have a good reason to. + 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; + }; +} diff --git a/hosts/wim/home/main.nix b/hosts/wim/home/main.nix index 19aef95f..01d600cf 100644 --- a/hosts/wim/home/main.nix +++ b/hosts/wim/home/main.nix @@ -14,12 +14,13 @@ matt = { imports = [ - ./dconf.nix ./theme.nix ./hyprland.nix ./dotfiles.nix ./packages.nix - ./firefox/main.nix + + ../../../modules/dconf.nix + ../../../modules/firefox/main.nix ]; home.stateVersion = "23.05"; diff --git a/hosts/wim/home/dconf.nix b/modules/dconf.nix similarity index 94% rename from hosts/wim/home/dconf.nix rename to modules/dconf.nix index 15ffc810..446a85d2 100644 --- a/hosts/wim/home/dconf.nix +++ b/modules/dconf.nix @@ -1,3 +1,5 @@ +# Home-manager module + { ... }: { dconf.settings = { "org/virt-manager/virt-manager/connections" = { diff --git a/hosts/wim/home/firefox/addons/addons.json b/modules/firefox/addons/addons.json similarity index 100% rename from hosts/wim/home/firefox/addons/addons.json rename to modules/firefox/addons/addons.json diff --git a/hosts/wim/home/firefox/addons/default.nix b/modules/firefox/addons/default.nix similarity index 100% rename from hosts/wim/home/firefox/addons/default.nix rename to modules/firefox/addons/default.nix diff --git a/hosts/wim/home/firefox/addons/generated-firefox-addons.nix b/modules/firefox/addons/generated-firefox-addons.nix similarity index 100% rename from hosts/wim/home/firefox/addons/generated-firefox-addons.nix rename to modules/firefox/addons/generated-firefox-addons.nix diff --git a/hosts/wim/home/firefox/custom.css b/modules/firefox/custom.css similarity index 100% rename from hosts/wim/home/firefox/custom.css rename to modules/firefox/custom.css diff --git a/hosts/wim/home/firefox/firefox-gx.nix b/modules/firefox/firefox-gx.nix similarity index 100% rename from hosts/wim/home/firefox/firefox-gx.nix rename to modules/firefox/firefox-gx.nix diff --git a/hosts/wim/home/firefox/main.nix b/modules/firefox/main.nix similarity index 100% rename from hosts/wim/home/firefox/main.nix rename to modules/firefox/main.nix