summary refs log tree commit diff
path: root/pkgs/applications/window-managers/wayfire/wrapper.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/window-managers/wayfire/wrapper.nix')
-rw-r--r--pkgs/applications/window-managers/wayfire/wrapper.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/pkgs/applications/window-managers/wayfire/wrapper.nix b/pkgs/applications/window-managers/wayfire/wrapper.nix
new file mode 100644
index 00000000000..62292898547
--- /dev/null
+++ b/pkgs/applications/window-managers/wayfire/wrapper.nix
@@ -0,0 +1,39 @@
+{ runCommandNoCC, lib, makeWrapper, wayfirePlugins }:
+
+let
+  inherit (lib) escapeShellArg makeBinPath;
+
+  xmlPath = plugin: "${plugin}/share/wayfire/metadata/wf-shell";
+
+  makePluginPath = lib.makeLibraryPath;
+  makePluginXMLPath = lib.concatMapStringsSep ":" xmlPath;
+in
+
+application:
+
+choosePlugins:
+
+let
+  plugins = choosePlugins wayfirePlugins;
+in
+
+runCommandNoCC "${application.name}-wrapped" {
+  nativeBuildInputs = [ makeWrapper ];
+
+  passthru = application.passthru // {
+    unwrapped = application;
+  };
+
+  inherit (application) meta;
+} ''
+  mkdir -p $out/bin
+  for bin in ${application}/bin/*
+  do
+      makeWrapper "$bin" $out/bin/''${bin##*/} \
+          --suffix PATH : ${escapeShellArg (makeBinPath plugins)} \
+          --suffix WAYFIRE_PLUGIN_PATH : ${escapeShellArg (makePluginPath plugins)} \
+          --suffix WAYFIRE_PLUGIN_XML_PATH : ${escapeShellArg (makePluginXMLPath plugins)}
+  done
+  find ${application} -mindepth 1 -maxdepth 1 -not -name bin \
+      -exec ln -s '{}' $out ';'
+''