2021-08-15 15:12:23 +00:00
|
|
|
{ runCommand, lib, makeWrapper, wayfirePlugins }:
|
2020-05-02 18:08:22 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-08-15 15:12:23 +00:00
|
|
|
runCommand "${application.name}-wrapped" {
|
2020-05-02 18:08:22 +00:00
|
|
|
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 ';'
|
|
|
|
''
|