From badf80096098d5967f3216561e6692826b82985b Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Mon, 3 Jun 2024 23:24:24 -0400 Subject: [PATCH] nixos: added webcord overlay for wayland ime --- nixosModules/default.nix | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/nixosModules/default.nix b/nixosModules/default.nix index 9c842ae3..b587c214 100644 --- a/nixosModules/default.nix +++ b/nixosModules/default.nix @@ -1,6 +1,7 @@ inputs: { config, pkgs, + lib, ... }: { imports = [ @@ -12,4 +13,32 @@ inputs: { ./system ./user ]; + + nixpkgs.overlays = [ + (final: prev: { + webcord = prev.webcord.overrideAttrs (old: { + installPhase = let + binPath = lib.makeBinPath [pkgs.xdg-utils]; + in '' + runHook preInstall + + # 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 + ''; + }); + }) + ]; }