Add gpu toggles at boot time
This commit is contained in:
parent
5001bba217
commit
672167c250
2 changed files with 33 additions and 36 deletions
|
@ -17,6 +17,7 @@ in {
|
|||
#./egirls-qa.nix
|
||||
./postfix.nix
|
||||
./nebula.nix
|
||||
./gpu.nix
|
||||
#./stalwart.nix
|
||||
#./vpn.nix
|
||||
#/home/jaina/src/nix-deployments/nordvpn/containers.nix
|
||||
|
@ -85,34 +86,10 @@ in {
|
|||
|
||||
programs.steam.enable = true;
|
||||
|
||||
services.xserver.videoDrivers = [ "nvidia" "modesetting" ];
|
||||
#services.xserver.videoDrivers = [ "modesetting" "nvidia" "displaylink" ];
|
||||
#services.xserver.videoDrivers = [ "modesetting" "nouveau" ];
|
||||
# specialisation.nouveau.configuration = { ... }: {
|
||||
# services.xserver.videoDrivers = [ "modesetting" "nouveau" ];
|
||||
# boot.blacklistedKernelModules = [ "bbswitch" "nvidia" "nvidia-drm" ];
|
||||
# };
|
||||
# nixpkgs.overlays = [
|
||||
# (self: prev: {
|
||||
# unstable = import unstableTarball { config = config.nixpkgs.config; };
|
||||
# })
|
||||
services.xserver.videoDrivers = [ "modesetting" ];
|
||||
|
||||
# # (self: prev: {
|
||||
# # sway-unwrapped = prev.sway-unwrapped.override {
|
||||
# # wlroots_0_16 = self.wlroots_0_16.overrideAttrs {
|
||||
# # patches = [
|
||||
# # (prev.fetchpatch {
|
||||
# # url =
|
||||
# # "https://gitlab.freedesktop.org/wlroots/wlroots/uploads/b4f932e370ed03d88f202191eaf60965/DisplayLink.patch";
|
||||
# # sha256 = lib.fakeHash;
|
||||
# # })
|
||||
# # ];
|
||||
# # };
|
||||
# # };
|
||||
# # })
|
||||
|
||||
# ];
|
||||
#nixpkgs.overlays = [ (self: prev: { mesa = prev.unstable.mesa; }) ];
|
||||
specialisation.nouveau.configuration = { jaina.gpuDriver = "nouveau"; };
|
||||
specialisation.intel.configuration = { jaina.gpuDriver = "intel"; };
|
||||
|
||||
hardware.opengl = {
|
||||
enable = true;
|
||||
|
@ -127,15 +104,7 @@ in {
|
|||
intel-gpu-tools
|
||||
];
|
||||
};
|
||||
hardware.nvidia.modesetting.enable = true;
|
||||
boot.blacklistedKernelModules = [ "nouveau" "bbswitch" ];
|
||||
#[ "nvidia" ];
|
||||
#boot.kernelParams = [ "i915.force_probe=46a6" ];
|
||||
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
# hardware.nvidia.package =
|
||||
# config.boot.kernelPackages.nvidiaPackages.production;
|
||||
#hardware.nvidia.package = unstable.linuxKernel.packages.linux_6_1.nvidia_x11;
|
||||
hardware.nvidia.open = true;
|
||||
|
||||
environment.sessionVariables = { LIBVA_DRIVER_NAME = "iHD"; };
|
||||
|
||||
networking.hostName = "harrowhark"; # Define your hostname.
|
||||
|
|
28
gpu.nix
Normal file
28
gpu.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let cfg = config.jaina;
|
||||
in {
|
||||
options = {
|
||||
jaina.gpuDriver = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "nvidia";
|
||||
};
|
||||
};
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf (cfg.gpuDriver == "nvidia") {
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
hardware.nvidia.modesetting.enable = true;
|
||||
hardware.nvidia.open = true;
|
||||
hardware.nvidia.package =
|
||||
config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
boot.blacklistedKernelModules = [ "nouveau" ];
|
||||
})
|
||||
(lib.mkIf (cfg.gpuDriver == "nouveau") {
|
||||
services.xserver.videoDrivers = [ "nouveau" ];
|
||||
boot.blacklistedKernelModules = [ "nvidia" "nvidia-drm" ];
|
||||
})
|
||||
(lib.mkIf (cfg.gpuDriver == "intel") {
|
||||
boot.blacklistedKernelModules = [ "nouveau" "nvidia" "nvidia-drm" ];
|
||||
})
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue