From 96d219385684af1b97c87a473202f1ca22fe86a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czy=C5=BC?= Date: Fri, 19 Apr 2024 19:09:26 +0200 Subject: [PATCH] split into multiple files, added dwm --- home-manager/features/desktop/dwm/default.nix | 12 + home-manager/home.nix | 4 +- hosts/common/default.nix | 89 +++++++ hosts/common/gui.nix | 36 +++ hosts/common/locale.nix | 23 ++ hosts/common/packages.nix | 20 ++ hosts/common/services.nix | 66 +++++ hosts/common/users.nix | 20 ++ hosts/thor/configuration.nix | 191 +------------- hosts/zion/configuration.nix | 240 +----------------- hosts/zion/nvidia.nix | 50 ++++ 11 files changed, 322 insertions(+), 429 deletions(-) create mode 100644 home-manager/features/desktop/dwm/default.nix create mode 100644 hosts/common/default.nix create mode 100644 hosts/common/gui.nix create mode 100644 hosts/common/locale.nix create mode 100644 hosts/common/packages.nix create mode 100644 hosts/common/services.nix create mode 100644 hosts/common/users.nix create mode 100644 hosts/zion/nvidia.nix diff --git a/home-manager/features/desktop/dwm/default.nix b/home-manager/features/desktop/dwm/default.nix new file mode 100644 index 0000000..915fd71 --- /dev/null +++ b/home-manager/features/desktop/dwm/default.nix @@ -0,0 +1,12 @@ +{ + lib, + config, + pkgs, + ... +}: { + home.packages = with pkgs; [ + rofi + dmenu + st + ]; +} diff --git a/home-manager/home.nix b/home-manager/home.nix index ddf8d70..81faa78 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -19,7 +19,7 @@ # You can also split up your configuration and import pieces of it here: # ./nvim.nix ./features/cli - ./features/desktop/hyprland + ./features/desktop/dwm ./features/kitty.nix ./features/neovim.nix ]; @@ -85,8 +85,6 @@ kitty kitty-themes - hyprland - # > tools < rofi git diff --git a/hosts/common/default.nix b/hosts/common/default.nix new file mode 100644 index 0000000..37a6414 --- /dev/null +++ b/hosts/common/default.nix @@ -0,0 +1,89 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + imports = [ + ./gui.nix + ./locale.nix + ./packages.nix + ./services.nix + ./users.nix + ]; + + + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # I'm sorry Richard Stallman + allowUnfree = true; + }; + }; + + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); + + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nix.nixPath = ["/etc/nix/path"]; + environment.etc = + lib.mapAttrs' + (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) + config.nix.registry; + + nix.settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Deduplicate and optimize nix store + auto-optimise-store = true; + # Use cache servers for packages + substituters = [ + "https://nix-community.cachix.org" + "https://cache.nixos.org/" + ]; + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Enables wireless support via wpa_supplicant + # networking.wireless.enable = true; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone + time.timeZone = "Europe/Warsaw"; +} diff --git a/hosts/common/gui.nix b/hosts/common/gui.nix new file mode 100644 index 0000000..87a0f59 --- /dev/null +++ b/hosts/common/gui.nix @@ -0,0 +1,36 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # X Server settings + services.xserver = { + enable = true; + layout = "pl"; + xkbVariant = ""; + + displayManager = { + lightdm = { + enable = false; + }; + startx = { + enable = true; + }; + }; + + windowManager = { + dwm = { + enable = true; + }; + }; + + desktopManager = { + xfce = { + enable = false; + }; + }; + }; +} diff --git a/hosts/common/locale.nix b/hosts/common/locale.nix new file mode 100644 index 0000000..c919dc9 --- /dev/null +++ b/hosts/common/locale.nix @@ -0,0 +1,23 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # Select internationalisation properties + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "pl_PL.UTF-8"; + LC_IDENTIFICATION = "pl_PL.UTF-8"; + LC_MEASUREMENT = "pl_PL.UTF-8"; + LC_MONETARY = "pl_PL.UTF-8"; + LC_NAME = "pl_PL.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "pl_PL.UTF-8"; + LC_TELEPHONE = "pl_PL.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; +} diff --git a/hosts/common/packages.nix b/hosts/common/packages.nix new file mode 100644 index 0000000..c84d766 --- /dev/null +++ b/hosts/common/packages.nix @@ -0,0 +1,20 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + environment.systemPackages = (with pkgs; [ + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + # wget + ntfs3g + dosfstools + unstable.nh + nix-output-monitor + nvd + ]); + + fonts.packages = with pkgs; [ nerdfonts ]; +} diff --git a/hosts/common/services.nix b/hosts/common/services.nix new file mode 100644 index 0000000..59951dd --- /dev/null +++ b/hosts/common/services.nix @@ -0,0 +1,66 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + + # I use zsh btw + environment.shells = with pkgs; [ bash zsh ]; + users.defaultUserShell = pkgs.zsh; + programs.zsh.enable = true; + + # Configure console keymap + console.keyMap = "pl2"; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + programs.mtr.enable = true; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + # This setups a SSH server. Very important if you're setting up a headless system. + # Feel free to remove if you don't need it. + services.openssh = { + enable = true; + settings = { + # Forbid root login through SSH. + PermitRootLogin = "no"; + # Use keys only. Remove if you want to SSH using password (not recommended) + PasswordAuthentication = true; + }; + }; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; +} diff --git a/hosts/common/users.nix b/hosts/common/users.nix new file mode 100644 index 0000000..94d69ba --- /dev/null +++ b/hosts/common/users.nix @@ -0,0 +1,20 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users = { + mike = { + isNormalUser = true; + description = "Mike"; + openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDfqPj+a2gmoUl3TuGSZxf0zRBabVWvXRrjLF7sFlqjMbfkx428F3L7C8OC3Z9XDT4ysbpgWcPuVKNtK5kkKGjSLHAgB2CgvD15K11Q+ag1+uyePaiOypZYJewvv1hhqU5IrVcxUbTsbREH/IsdQSlNSuyNFIr3oFnrff5iKEKEwEvSDeiqpqRh56pAkF6Kb15aYqZO7X9rbfoa8Sgj3VJXN0181lXMjXkNsYVa3gDmKv89C6qutg+KOpHlXgn4AfIRcCw8ik6OGBEfi/gUeb3SYpD+7undNLyloxCbGwHQ40IdoqPatyhTNS4jm9kb+Tno4hj0pbLHZSUdXgGaSfGx1W0MVVY0mm0Hu7EmYDBHUTfmPmPxnolWh8UH+XdkNPnwZfyZlyBcVVkVzog1ZCs1i9Y6oS1ZIbzuz+WxBPPDIHMRdmxv6+PMc5kZyrpuX1PgFb7Xt5cRNAL5/wywoi9Z45SS7qP9zNSb443UaaXzUatqnlawZ0GS0qXJh3ljwJ8= mike@odin" + ]; + extraGroups = [ "networkmanager" "wheel" ]; + }; + }; +} diff --git a/hosts/thor/configuration.nix b/hosts/thor/configuration.nix index 6d60066..fa27722 100644 --- a/hosts/thor/configuration.nix +++ b/hosts/thor/configuration.nix @@ -20,204 +20,15 @@ # You can also split up your configuration and import pieces of it here: # ./users.nix + ../common # Import your generated (nixos-generate-config) hardware configuration ./hardware-configuration.nix ]; - nixpkgs = { - # You can add overlays here - overlays = [ - # Add overlays your own flake exports (from overlays and pkgs dir): - outputs.overlays.additions - outputs.overlays.modifications - outputs.overlays.unstable-packages - - # You can also add overlays exported from other flakes: - # neovim-nightly-overlay.overlays.default - - # Or define it inline, for example: - # (final: prev: { - # hi = final.hello.overrideAttrs (oldAttrs: { - # patches = [ ./change-hello-to-hi.patch ]; - # }); - # }) - ]; - # Configure your nixpkgs instance - config = { - # I'm sorry Richard Stallman - allowUnfree = true; - }; - }; - - # This will add each flake input as a registry - # To make nix3 commands consistent with your flake - nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); - - # This will additionally add your inputs to the system's legacy channels - # Making legacy nix commands consistent as well, awesome! - nix.nixPath = ["/etc/nix/path"]; - environment.etc = - lib.mapAttrs' - (name: value: { - name = "nix/path/${name}"; - value.source = value.flake; - }) - config.nix.registry; - - nix.settings = { - # Enable flakes and new 'nix' command - experimental-features = "nix-command flakes"; - # Deduplicate and optimize nix store - auto-optimise-store = true; - # Use cache servers for packages - substituters = [ - "https://nix-community.cachix.org" - "https://cache.nixos.org/" - ]; - trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; - # Hostname networking.hostName = "thor"; - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - # Enables wireless support via wpa_supplicant - # networking.wireless.enable = true; - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Enable networking - networking.networkmanager.enable = true; - - # Set your time zone - time.timeZone = "Europe/Warsaw"; - - # Select internationalisation properties - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "pl_PL.UTF-8"; - LC_IDENTIFICATION = "pl_PL.UTF-8"; - LC_MEASUREMENT = "pl_PL.UTF-8"; - LC_MONETARY = "pl_PL.UTF-8"; - LC_NAME = "pl_PL.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "pl_PL.UTF-8"; - LC_TELEPHONE = "pl_PL.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - - # X Server settings - services.xserver = { - enable = true; - layout = "pl"; - xkbVariant = ""; - - displayManager = { - lightdm = { - enable = false; - }; - startx = { - enable = true; - }; - }; - - desktopManager = { - xfce = { - enable = false; - }; - }; - }; - - # I use zsh btw - environment.shells = with pkgs; [ bash zsh ]; - users.defaultUserShell = pkgs.zsh; - programs.zsh.enable = true; - - # Configure console keymap - console.keyMap = "pl2"; - - # Enable CUPS to print documents. - services.printing.enable = true; - - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; - - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; - }; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users = { - mike = { - isNormalUser = true; - description = "Mike"; - openssh.authorizedKeys.keys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDfqPj+a2gmoUl3TuGSZxf0zRBabVWvXRrjLF7sFlqjMbfkx428F3L7C8OC3Z9XDT4ysbpgWcPuVKNtK5kkKGjSLHAgB2CgvD15K11Q+ag1+uyePaiOypZYJewvv1hhqU5IrVcxUbTsbREH/IsdQSlNSuyNFIr3oFnrff5iKEKEwEvSDeiqpqRh56pAkF6Kb15aYqZO7X9rbfoa8Sgj3VJXN0181lXMjXkNsYVa3gDmKv89C6qutg+KOpHlXgn4AfIRcCw8ik6OGBEfi/gUeb3SYpD+7undNLyloxCbGwHQ40IdoqPatyhTNS4jm9kb+Tno4hj0pbLHZSUdXgGaSfGx1W0MVVY0mm0Hu7EmYDBHUTfmPmPxnolWh8UH+XdkNPnwZfyZlyBcVVkVzog1ZCs1i9Y6oS1ZIbzuz+WxBPPDIHMRdmxv6+PMc5kZyrpuX1PgFb7Xt5cRNAL5/wywoi9Z45SS7qP9zNSb443UaaXzUatqnlawZ0GS0qXJh3ljwJ8= mike@odin" - ]; - extraGroups = [ "networkmanager" "wheel" ]; - }; - }; - - environment.systemPackages = (with pkgs; [ - # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - # wget - ntfs3g - dosfstools - unstable.nh - nix-output-monitor - nvd - ]); - - fonts.packages = with pkgs; [ nerdfonts ]; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - programs.mtr.enable = true; - programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - - # This setups a SSH server. Very important if you're setting up a headless system. - # Feel free to remove if you don't need it. - services.openssh = { - enable = true; - settings = { - # Forbid root login through SSH. - PermitRootLogin = "no"; - # Use keys only. Remove if you want to SSH using password (not recommended) - PasswordAuthentication = true; - }; - }; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave diff --git a/hosts/zion/configuration.nix b/hosts/zion/configuration.nix index da95b6a..d2a1c5d 100644 --- a/hosts/zion/configuration.nix +++ b/hosts/zion/configuration.nix @@ -20,250 +20,18 @@ # You can also split up your configuration and import pieces of it here: # ./users.nix + ../common + + # nvidia drivers + ./nvidia.nix # Import your generated (nixos-generate-config) hardware configuration ./hardware-configuration.nix ]; - nixpkgs = { - # You can add overlays here - overlays = [ - # Add overlays your own flake exports (from overlays and pkgs dir): - outputs.overlays.additions - outputs.overlays.modifications - outputs.overlays.unstable-packages - - # You can also add overlays exported from other flakes: - # neovim-nightly-overlay.overlays.default - - # Or define it inline, for example: - # (final: prev: { - # hi = final.hello.overrideAttrs (oldAttrs: { - # patches = [ ./change-hello-to-hi.patch ]; - # }); - # }) - ]; - # Configure your nixpkgs instance - config = { - # I'm sorry Richard Stallman - allowUnfree = true; - }; - }; - - # This will add each flake input as a registry - # To make nix3 commands consistent with your flake - nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); - - # This will additionally add your inputs to the system's legacy channels - # Making legacy nix commands consistent as well, awesome! - nix.nixPath = ["/etc/nix/path"]; - environment.etc = - lib.mapAttrs' - (name: value: { - name = "nix/path/${name}"; - value.source = value.flake; - }) - config.nix.registry; - - nix.settings = { - # Enable flakes and new 'nix' command - experimental-features = "nix-command flakes"; - # Deduplicate and optimize nix store - auto-optimise-store = true; - # Use cache servers for packages - substituters = [ - "https://nix-community.cachix.org" - "https://cache.nixos.org/" - ]; - trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - }; - # Hostname networking.hostName = "zion"; - # Bootloader settings - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - # Enables wireless support via wpa_supplicant - # networking.wireless.enable = true; - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Enable networking - networking.networkmanager.enable = true; - - # Set your time zone - time.timeZone = "Europe/Warsaw"; - - # Select internationalisation properties - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "pl_PL.UTF-8"; - LC_IDENTIFICATION = "pl_PL.UTF-8"; - LC_MEASUREMENT = "pl_PL.UTF-8"; - LC_MONETARY = "pl_PL.UTF-8"; - LC_NAME = "pl_PL.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "pl_PL.UTF-8"; - LC_TELEPHONE = "pl_PL.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - - # X Server settings - services.xserver = { - enable = true; - layout = "pl"; - xkbVariant = ""; - - displayManager = { - lightdm = { - enable = false; - }; - startx = { - enable = true; - }; - }; - - desktopManager = { - xfce = { - enable = false; - }; - }; - }; - - # 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. - # 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 = true; - - # Optionally, you may need to select the appropriate driver version for your specific GPU. - package = config.boot.kernelPackages.nvidiaPackages.stable; - }; - - # I use zsh btw - environment.shells = with pkgs; [ bash zsh ]; - users.defaultUserShell = pkgs.zsh; - programs.zsh.enable = true; - - # Configure console keymap - console.keyMap = "pl2"; - - # Enable CUPS to print documents. - services.printing.enable = true; - - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; - - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; - }; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users = { - mike = { - isNormalUser = true; - description = "Mike"; - openssh.authorizedKeys.keys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDfqPj+a2gmoUl3TuGSZxf0zRBabVWvXRrjLF7sFlqjMbfkx428F3L7C8OC3Z9XDT4ysbpgWcPuVKNtK5kkKGjSLHAgB2CgvD15K11Q+ag1+uyePaiOypZYJewvv1hhqU5IrVcxUbTsbREH/IsdQSlNSuyNFIr3oFnrff5iKEKEwEvSDeiqpqRh56pAkF6Kb15aYqZO7X9rbfoa8Sgj3VJXN0181lXMjXkNsYVa3gDmKv89C6qutg+KOpHlXgn4AfIRcCw8ik6OGBEfi/gUeb3SYpD+7undNLyloxCbGwHQ40IdoqPatyhTNS4jm9kb+Tno4hj0pbLHZSUdXgGaSfGx1W0MVVY0mm0Hu7EmYDBHUTfmPmPxnolWh8UH+XdkNPnwZfyZlyBcVVkVzog1ZCs1i9Y6oS1ZIbzuz+WxBPPDIHMRdmxv6+PMc5kZyrpuX1PgFb7Xt5cRNAL5/wywoi9Z45SS7qP9zNSb443UaaXzUatqnlawZ0GS0qXJh3ljwJ8= mike@odin" - ]; - extraGroups = [ "networkmanager" "wheel" ]; - }; - }; - - environment.systemPackages = (with pkgs; [ - # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - # wget - ntfs3g - dosfstools - unstable.nh - nix-output-monitor - nvd - ]); - - environment.sessionVariables = { - FLAKE = "/home/mike/.dots"; - }; - - fonts.packages = with pkgs; [ nerdfonts ]; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - programs.mtr.enable = true; - programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - - # This setups a SSH server. Very important if you're setting up a headless system. - # Feel free to remove if you don't need it. - services.openssh = { - enable = true; - settings = { - # Forbid root login through SSH. - PermitRootLogin = "no"; - # Use keys only. Remove if you want to SSH using password (not recommended) - PasswordAuthentication = true; - }; - }; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave diff --git a/hosts/zion/nvidia.nix b/hosts/zion/nvidia.nix new file mode 100644 index 0000000..0656f3b --- /dev/null +++ b/hosts/zion/nvidia.nix @@ -0,0 +1,50 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}:{ + # 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. + # 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 = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; +}