nix: simplify wayland-ime overlays for electron apps

This commit is contained in:
Aly Raffauf 2024-06-07 14:58:31 -04:00
parent 4ab7829ab5
commit a7e065b4d1

View file

@ -42,48 +42,19 @@ in {
hyprland = inputs.hyprland.packages.${pkgs.system}.hyprland; hyprland = inputs.hyprland.packages.${pkgs.system}.hyprland;
hyprnome = unstable.hyprnome; hyprnome = unstable.hyprnome;
obsidian = unstable.obsidian.overrideAttrs (old: { obsidian = unstable.obsidian.overrideAttrs (old: {
installPhase = '' installPhase =
runHook preInstall builtins.replaceStrings ["--ozone-platform=wayland"]
mkdir -p $out/bin ["--ozone-platform=wayland --enable-wayland-ime"]
makeWrapper ${pkgs.electron}/bin/electron $out/bin/obsidian \ old.installPhase;
--add-flags $out/share/obsidian/app.asar \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-wayland-ime}}"
install -m 444 -D resources/app.asar $out/share/obsidian/app.asar
install -m 444 -D resources/obsidian.asar $out/share/obsidian/obsidian.asar
install -m 444 -D "${old.desktopItem}/share/applications/"* \
-t $out/share/applications/
for size in 16 24 32 48 64 128 256 512; do
mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
convert -background none -resize "$size"x"$size" ${old.icon} $out/share/icons/hicolor/"$size"x"$size"/apps/obsidian.png
done
runHook postInstall
'';
}); });
sway = unstable.sway; sway = unstable.sway;
swayfx = unstable.swayfx; swayfx = unstable.swayfx;
vscodium = prev.vscodium.override {commandLineArgs = "--gtk-version=4 --enable-wayland-ime";}; vscodium = prev.vscodium.override {commandLineArgs = "--gtk-version=4 --enable-wayland-ime";};
webcord = prev.webcord.overrideAttrs (old: { webcord = prev.webcord.overrideAttrs (old: {
installPhase = let installPhase =
binPath = lib.makeBinPath [pkgs.xdg-utils]; builtins.replaceStrings ["--ozone-platform-hint=auto"]
in '' ["--ozone-platform-hint=auto --enable-wayland-ime"]
runHook preInstall old.installPhase;
# Remove dev deps that aren't necessary for running the app
npm prune --omit=dev
mkdir -p $out/lib/node_modules/webcord
cp -r app node_modules sources package.json $out/lib/node_modules/webcord/
install -Dm644 sources/assets/icons/app.png $out/share/icons/hicolor/256x256/apps/webcord.png
# Add xdg-utils to path via suffix, per PR #181171
makeWrapper '${lib.getExe pkgs.electron}' $out/bin/webcord \
--suffix PATH : "${binPath}" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime}}" \
--add-flags $out/lib/node_modules/webcord/
runHook postInstall
'';
}); });
}) })
]; ];