This commit is contained in:
Peder Bergebakken Sundt 2023-12-03 20:54:58 +01:00
parent 42fb12b5c7
commit 46f6bb5823
3 changed files with 46 additions and 73 deletions

View File

@ -18,19 +18,21 @@
hardware.opengl.enable = true;
hardware.opengl.driSupport = true;
hardware.opengl.driSupport32Bit = true;
hardware.opengl.extraPackages = with pkgs; [
vaapiVdpau
libvdpau-va-gl
#vaapiVdpau
#libvdpau-va-gl
nvidia-vaapi-driver
];
hardware.nvidia.modesetting.enable = lib.mkDefault true; # needed for most wayland compositors
hardware.nvidia.nvidiaSettings = true;
#hardware.nvidia.open = true; # open source version of kernel module, only on driver 515.43.04+
#hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.latest; # only do this per-host
hardware.nvidia.powerManagement.enable = true; # Fix graphical corruption on suspend/resume
hardware.nvidia.nvidiaSettings = lib.mkDefault true;
#hardware.nvidia.open = lib.mkDefault true; # open source version of kernel module, only on driver 515.43.04+
#hardware.nvidia.package = lib.mkDefault config.boot.kernelPackages.nvidiaPackages.latest; # only do this per-host
hardware.nvidia.powerManagement.enable = lib.mkDefault true; # Fix graphical corruption on suspend/resume
virtualisation.docker.enableNvidia = true;
virtualisation.podman.enableNvidia = true;
virtualisation.docker.enableNvidia = lib.mkDefault true;
virtualisation.podman.enableNvidia = lib.mkDefault true;
# add this to the host in question:
#hardware.nvidia.prime = {
@ -61,4 +63,40 @@
# exec "$@"
#'')
]);
# nvidia bad
nixpkgs.config.packageOverrides = (pkgs: {
teams = pkgs.teams.overrideAttrs (old: rec {
postInstall = (old.postInstall or "") + ''
substituteInPlace $out/share/applications/teams.desktop \
--replace 'Exec=teams' 'Exec=teams --use-gl=desktop'
'';
# --replace 'Exec=teams' 'Exec=teams --disable-gpu'
});
discord = pkgs.discord.overrideAttrs (old: rec {
desktopItem = old.desktopItem.override (old: {
#exec = "env NIXOS_OZONE_WL=1 ${old.exec}";
exec = "${old.exec} --use-gl=desktop";
});
postInstall = ''
ln -sf "${desktopItem}/share/applications" $out/share/
'' + old.postInstall;
});
slack = pkgs.slack.overrideAttrs (old: {
postInstall = old.postInstall or "" + ''
substituteInPlace $out/share/applications/slack.desktop \
--replace "$out/bin/slack " "$out/bin/slack --use-gl=desktop "
'';
# --replace "$out/bin/slack " "$out/bin/slack --disable-gpu --in-process-gpu "
});
element-desktop = pkgs.element-desktop.overrideAttrs (old: {
desktopItem = old.desktopItem.override (old: {
#exec = "env NIXOS_OZONE_WL=1 element-desktop %u";
#exec = "element-desktop --disable-gpu --in-process-gpu %u";
exec = "element-desktop --use-gl=desktop %u";
});
});
});
}

View File

@ -60,38 +60,6 @@
# TODO: remove? Move?
programs.dconf.enable = true;
# nvidia bad
#nixpkgs.config.packageOverrides = lib.mkIf (!config.hardware.nvidia.prime.offload.enable) (pkgs: {
nixpkgs.config.packageOverrides = (pkgs: {
teams = pkgs.teams.overrideAttrs (old: rec {
postInstall = (old.postInstall or "") + ''
substituteInPlace $out/share/applications/teams.desktop \
--replace 'Exec=teams' 'Exec=teams --disable-gpu'
'';
});
discord = pkgs.discord.overrideAttrs (old: rec {
desktopItem = old.desktopItem.override (old: {
#exec = "${pkgs.coreutils}/bin/env NIXOS_OZONE_WL=1 ${old.exec}";
exec = "${pkgs.coreutils-full}/bin/env NIXOS_OZONE_WL=1 Discord";
});
postInstall = ''
ln -sf "${desktopItem}/share/applications" $out/share/
'' + old.postInstall;
});
slack = pkgs.slack.overrideAttrs (old: {
postInstall = old.postInstall or "" + ''
substituteInPlace $out/share/applications/slack.desktop \
--replace "$out/bin/slack " "$out/bin/slack --disable-gpu --in-process-gpu "
'';
});
element-desktop = pkgs.element-desktop.overrideAttrs (old: {
desktopItem = old.desktopItem.override (old: {
exec = "element-desktop --disable-gpu --in-process-gpu %u";
});
});
});
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;

View File

@ -102,39 +102,6 @@
# TODO: remove? Move?
programs.dconf.enable = true;
# nvidia bad
#nixpkgs.config.packageOverrides = lib.mkIf (!config.hardware.nvidia.prime.offload.enable) (pkgs: {
nixpkgs.config.packageOverrides = (pkgs: {
teams = pkgs.teams.overrideAttrs (old: rec {
postInstall = (old.postInstall or "") + ''
substituteInPlace $out/share/applications/teams.desktop \
--replace 'Exec=teams' 'Exec=teams --disable-gpu'
'';
});
discord = pkgs.discord.overrideAttrs (old: rec {
desktopItem = old.desktopItem.override (old: {
exec = "${pkgs.coreutils}/bin/env NIXOS_OZONE_WL=1 ${old.exec}";
#exec = "${pkgs.coreutils-full}/bin/env NIXOS_OZONE_WL=1 Discord";
});
postInstall = ''
ln -sf "${desktopItem}/share/applications" $out/share/
'' + old.postInstall;
});
slack = pkgs.slack.overrideAttrs (old: {
postInstall = old.postInstall or "" + ''
substituteInPlace $out/share/applications/slack.desktop \
--replace "$out/bin/slack " "$out/bin/slack --disable-gpu --in-process-gpu "
'';
});
element-desktop = pkgs.element-desktop.overrideAttrs (old: {
desktopItem = old.desktopItem.override (old: {
exec = "element-desktop --disable-gpu --in-process-gpu %u";
#exec = "env NIXOS_OZONE_WL=1 element-desktop %u";
});
});
});
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;