better chromium / vscode wayland

This commit is contained in:
dusk 2021-08-21 18:57:52 +03:00
parent 3918630973
commit a991ffa4bf
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA
4 changed files with 111 additions and 92 deletions

View File

@ -0,0 +1,53 @@
_: prev:
let
pkgs = prev;
lib = pkgs.lib;
chromiumWayland =
let
flags = [
"--enable-vulkan"
"--flag-switches-begin"
"--enable-features=UseOzonePlatform,WebRTCPipeWireCapturer,IgnoreGPUBlocklist,Vulkan"
"--flag-switches-end"
"--ozone-platform=wayland"
"--enable-webrtc-pipewire-capturer"
"--ignore-gpu-blocklist"
"--enable-gpu-rasterization"
"--enable-zero-copy"
"--disable-gpu-driver-bug-workarounds"
];
in
pkgs.writeScriptBin "chromium-wayland" ''
#!${pkgs.stdenv.shell}
${pkgs.chromium}/bin/chromium ${lib.concatStringsSep " " flags}
'';
in
{
chromiumWayland =
let
pname = "chromium";
desktop = pkgs.makeDesktopItem {
name = pname;
exec = pname;
icon = "chromium-browser";
desktopName = "Chromium Wayland";
genericName = "Web Browser";
};
in
lib.hiPrio (pkgs.stdenv.mkDerivation {
inherit pname;
version = pkgs.chromium.version;
nativeBuildInputs = [ pkgs.makeWrapper ];
phases = [ "installPhase" "fixupPhase" ];
installPhase = ''
mkdir -p $out/bin
install -m755 ${chromiumWayland}/bin/${pname}-wayland $out/bin/${pname}
cp -r ${desktop}/share $out/share
'';
/*fixupPhase = ''
wrapProgram $out/bin/${name} \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath (with pkgs; [ vulkan-loader libGL ])}
'';*/
});
}

View File

@ -9,6 +9,7 @@ final: prev: rec {
sha256 = "sha256-EraTDRKd6t0c9U68tSRdGkeB1hfqNS4KUewEXwkL8io=";
};
isWayland = true;
enableVulkan = true;
extraOptions = [
"--enable-vulkan"
"--ignore-gpu-blocklist"
@ -24,6 +25,7 @@ final: prev: rec {
, binaryName
, desktopName
, isWayland ? false
, enableVulkan ? false
, extraOptions ? [ ]
, autoPatchelfHook
, makeDesktopItem
@ -140,7 +142,7 @@ final: prev: rec {
flags = (lib.optionals isWayland [
"--flag-switches-begin"
"--enable-features=UseOzonePlatform,WebRTCPipeWireCapturer"
"--enable-features=UseOzonePlatform,WebRTCPipeWireCapturer${lib.optionalString enableVulkan ",Vulkan"}"
"--flag-switches-end"
"--ozone-platform=wayland"
"--enable-webrtc-pipewire-capturer"

View File

@ -0,0 +1,51 @@
_: prev:
let
pkgs = prev;
lib = pkgs.lib;
vscodeWayland =
let
flags = [
"--flag-switches-begin"
"--enable-features=UseOzonePlatform,WebRTCPipeWireCapturer,IgnoreGPUBlocklist,Vulkan"
"--flag-switches-end"
"--ozone-platform=wayland"
"--enable-webrtc-pipewire-capturer"
"--ignore-gpu-blocklist"
"--enable-gpu-rasterization"
"--enable-zero-copy"
"--disable-gpu-driver-bug-workarounds"
];
in
pkgs.writeScriptBin "vscode-wayland" ''
#!${pkgs.stdenv.shell}
${pkgs.vscode}/bin/code ${lib.concatStringsSep " " flags}
'';
in
{
vscodeWayland =
let
pname = "vscode";
desktop = pkgs.makeDesktopItem {
name = pname;
exec = pname;
icon = "vscode";
desktopName = "VSCode Wayland";
};
in
lib.hiPrio (pkgs.stdenv.mkDerivation {
inherit pname;
version = pkgs.vscode.version;
nativeBuildInputs = [ pkgs.makeWrapper ];
phases = [ "installPhase" "fixupPhase" ];
installPhase = ''
mkdir -p $out/bin
install -m755 ${vscodeWayland}/bin/${pname}-wayland $out/bin/${pname}
cp -r ${desktop}/share $out/share
'';
fixupPhase = ''
wrapProgram $out/bin/${pname} \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath (with pkgs; [ vulkan-loader vulkan-extension-layer libGL ])}
'';
});
}

View File

@ -94,92 +94,6 @@ in
fontComb = "${font} ${toString fontSize}";
fontPackage = pkgs.iosevka;
chromiumWayland =
let
flags = [
"--enable-vulkan"
"--flag-switches-begin"
"--enable-features=UseOzonePlatform,WebRTCPipeWireCapturer,IgnoreGPUBlocklis"
"--flag-switches-end"
"--ozone-platform=wayland"
"--enable-webrtc-pipewire-capturer"
"--ignore-gpu-blocklist"
"--enable-gpu-rasterization"
"--enable-zero-copy"
"--disable-gpu-driver-bug-workarounds"
];
in
pkgs.writeScriptBin "chromium-wayland" ''
#!${pkgs.stdenv.shell}
VK_ICD_FILENAMES="${pkgs.amdvlk}/share/vulkan/icd.d/amd_icd64.json:${pkgs.driversi686Linux.amdvlk}/share/vulkan/icd.d/amd_icd32.json" chromium ${lib.concatStringsSep " " flags}
'';
vscodiumWayland =
let
flags = [
"--enable-vulkan"
"--flag-switches-begin"
"--enable-features=UseOzonePlatform,WebRTCPipeWireCapturer,IgnoreGPUBlocklist"
"--flag-switches-end"
"--ozone-platform=wayland"
"--enable-webrtc-pipewire-capturer"
"--ignore-gpu-blocklist"
"--enable-gpu-rasterization"
"--enable-zero-copy"
"--disable-gpu-driver-bug-workarounds"
];
in
pkgs.writeScriptBin "vscodium-wayland" ''
#!${pkgs.stdenv.shell}
code ${lib.concatStringsSep " " flags}
'';
vscodiumWaylandPkg =
let
name = "vscodium-wayland";
desktop = pkgs.makeDesktopItem {
inherit name;
exec = name;
icon = "vscodium";
desktopName = "VSCodium Wayland";
};
in
pkgs.stdenv.mkDerivation {
name = name;
nativeBuildInputs = [ pkgs.makeWrapper ];
phases = [ "installPhase" "fixupPhase" ];
installPhase = ''
mkdir -p $out/bin
ln -s ${vscodiumWayland}/bin/${name} $out/bin
ln -s ${desktop}/share $out/share
'';
fixupPhase = ''
wrapProgram $out/bin/${name} \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath (with pkgs; [ vulkan-loader vulkan-extension-layer libGL ])}
'';
};
chromiumWaylandPkg =
let
name = "chromium-wayland";
desktop = pkgs.makeDesktopItem {
inherit name;
exec = name;
icon = "chromium-browser";
desktopName = "Chromium Wayland";
genericName = "Web Browser";
};
in
pkgs.stdenv.mkDerivation {
name = name;
nativeBuildInputs = [ pkgs.makeWrapper ];
phases = [ "installPhase" "fixupPhase" ];
installPhase = ''
mkdir -p $out/bin
ln -s ${chromiumWayland}/bin/${name} $out/bin
ln -s ${desktop}/share $out/share
'';
};
colorSchemeLight = {
primary = {
normal = {
@ -348,7 +262,6 @@ in
homeDirectory = nixosConfig.users.users.patriot.home;
packages = with pkgs;
[
libnotify-latest
# Font stuff
fontPackage
noto-fonts-cjk
@ -356,9 +269,9 @@ in
dejavu_fonts
(nerdfonts.override { fonts = [ "Iosevka" ]; })
# Programs
discord-canary-system
# discord-canary-system
# element-desktop
gh
# gh
vulkan-tools
audacity
krita
@ -368,8 +281,6 @@ in
gnome3.gnome-boxes
wine-staging
cachix
chromiumWaylandPkg
vscodiumWaylandPkg
appimage-run
bitwarden
pfetch
@ -511,6 +422,7 @@ in
};
chromium = {
enable = true;
package = pkgs.chromiumWayland;
extensions = [
"gcbommkclmclpchllfjekcdonpmejbdp" # https everywhere
"cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock
@ -667,6 +579,7 @@ in
};
vscode = {
enable = true;
package = pkgs.vscodeWayland;
extensions =
let
mkExt = n: v: p: s: { name = n; version = v; publisher = p; sha256 = s; };