From 434e6b2a9f9e7f3f37ca110d6ccde82a2f8331e7 Mon Sep 17 00:00:00 2001 From: deva Date: Sat, 6 Jul 2024 09:40:47 -0400 Subject: [PATCH] virtualisation, nix-index, and nvidia --- os/configuration.nix | 57 +++++++++++++++++++++++++++++++++++++++- os/shell/prompt-zen.toml | 2 +- os/shell/zsh.nix | 2 +- os/users.nix | 1 + os/util/user.nix | 10 +++---- 5 files changed, 64 insertions(+), 8 deletions(-) diff --git a/os/configuration.nix b/os/configuration.nix index 8fb13ae..422f08a 100644 --- a/os/configuration.nix +++ b/os/configuration.nix @@ -19,9 +19,10 @@ virtualisation.docker = { enable = true; - enableNvidia = builtins.any (driver: driver == "nvidia") config.services.xserver.videoDrivers; }; + virtualisation.containers.cdi.dynamic.nvidia.enable = builtins.any (driver: driver == "nvidia") config.services.xserver.videoDrivers; + virtualisation.vmware.host.enable = true; programs.seahorse.enable = true; @@ -37,8 +38,13 @@ environment.systemPackages = with pkgs; [ neovim firefox + #jmtpfs ]; + services.gvfs.enable = true; + + programs.adb.enable = true; + nix = let flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; in { @@ -196,4 +202,53 @@ (pkgs.nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];}) ]; }; + + #nvidia + hardware.opengl = { + enable = true; + driSupport32Bit = true; + }; + + 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; + + prime = { + intelBusId = "PCI:0:2:0"; + nvidiaBusId = "PCI:1:0:0"; + + offload = { + enable = true; + enableOffloadCmd = true; + }; + }; + }; } diff --git a/os/shell/prompt-zen.toml b/os/shell/prompt-zen.toml index 6c890ea..a28fb6e 100755 --- a/os/shell/prompt-zen.toml +++ b/os/shell/prompt-zen.toml @@ -51,7 +51,7 @@ console_title_template = '{{if .Root}}(Admin){{end}} {{ .PWD }}' "{{if gt .Code 0}}red{{end}}" ] background = 'transparent' - template = '{{if eq .UserName "root" }}#{{else}}~{{end}}' + template = '{{if eq .UserName "root" }}#{{else}}🞂{{end}}' [transient_prompt] foreground_templates = [ diff --git a/os/shell/zsh.nix b/os/shell/zsh.nix index b5ac256..5644231 100644 --- a/os/shell/zsh.nix +++ b/os/shell/zsh.nix @@ -6,7 +6,7 @@ programs.bat.enable = true; programs.eza.enable = true; programs.man.enable = true; - programs.nix-index.enableZshIntegration = false; + programs.nix-index.enableZshIntegration = true; home.packages = [ pkgs.unstable.steam-run ]; diff --git a/os/users.nix b/os/users.nix index ef69d90..b1cc813 100644 --- a/os/users.nix +++ b/os/users.nix @@ -22,6 +22,7 @@ blockbench blender prismlauncher + steam ]; }; user.root = { diff --git a/os/util/user.nix b/os/util/user.nix index a72e2ca..fc03972 100644 --- a/os/util/user.nix +++ b/os/util/user.nix @@ -183,8 +183,8 @@ in { home-manager.users = lib.mkIf (config.user != null) (lib.attrsets.mapAttrs (name: userConfig: { imports = [ - inputs.nix-index-db.hmModules.nix-index - ] + inputs.nix-index-db.hmModules.nix-index + ] ++ ( if name != "root" then [ @@ -303,9 +303,9 @@ in { }; programs.home-manager.enable = true; programs.git.enable = true; - programs.nix-index.enable = true; - programs.nix-index.symlinkToCacheHome = true; - programs.nix-index-database.comma.enable = true; + programs.nix-index.enable = true; + programs.nix-index.symlinkToCacheHome = true; + programs.nix-index-database.comma.enable = true; systemd.user.startServices = "sd-switch"; }) config.user);