@@ -0,0 +1,39 @@
1+{ runCommandNoCC, lib, makeWrapper, wayfirePlugins }:
2+
3+let
4+ inherit (lib) escapeShellArg makeBinPath;
5+
6+ xmlPath = plugin: "${plugin}/share/wayfire/metadata/wf-shell";
7+
8+ makePluginPath = lib.makeLibraryPath;
9+ makePluginXMLPath = lib.concatMapStringsSep ":" xmlPath;
10+in
11+
12+application:
13+
14+choosePlugins:
15+
16+let
17+ plugins = choosePlugins wayfirePlugins;
18+in
19+
20+runCommandNoCC "${application.name}-wrapped" {
21+ nativeBuildInputs = [ makeWrapper ];
22+
23+ passthru = application.passthru // {
24+ unwrapped = application;
25+ };
26+
27+ inherit (application) meta;
28+} ''
29+ mkdir -p $out/bin
30+ for bin in ${application}/bin/*
31+ do
32+ makeWrapper "$bin" $out/bin/''${bin##*/} \
33+ --suffix PATH : ${escapeShellArg (makeBinPath plugins)} \
34+ --suffix WAYFIRE_PLUGIN_PATH : ${escapeShellArg (makePluginPath plugins)} \
35+ --suffix WAYFIRE_PLUGIN_XML_PATH : ${escapeShellArg (makePluginXMLPath plugins)}
36+ done
37+ find ${application} -mindepth 1 -maxdepth 1 -not -name bin \
38+ -exec ln -s '{}' $out ';'
39+''