wayfire: add plugin support

The top-level "wayfire" attribute is a Wayfire with wf-shell installed
and nothing else. But wayfireApplications.withPlugins can be used to
create a Wayfire with arbitrary plugins, or no plugins at all.

+80 -3
+23
pkgs/applications/window-managers/wayfire/applications.nix
···
··· 1 + { newScope, wayfirePlugins }: 2 + 3 + let 4 + self = with self; { 5 + inherit wayfirePlugins; 6 + 7 + callPackage = newScope self; 8 + 9 + wayfire = callPackage ./. { }; 10 + 11 + wcm = callPackage ./wcm.nix { 12 + inherit (wayfirePlugins) wf-shell; 13 + }; 14 + 15 + wrapWayfireApplication = callPackage ./wrapper.nix { }; 16 + 17 + withPlugins = selector: self // { 18 + wayfire = wrapWayfireApplication wayfire selector; 19 + wcm = wrapWayfireApplication wcm selector; 20 + }; 21 + }; 22 + in 23 + self
+12
pkgs/applications/window-managers/wayfire/plugins.nix
···
··· 1 + { newScope, wayfire }: 2 + 3 + let 4 + self = with self; { 5 + inherit wayfire; 6 + 7 + callPackage = newScope self; 8 + 9 + wf-shell = callPackage ./wf-shell.nix { }; 10 + }; 11 + in 12 + self
+39
pkgs/applications/window-managers/wayfire/wrapper.nix
···
··· 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 + ''
+6 -3
pkgs/top-level/all-packages.nix
··· 24755 way-cooler = throw ("way-cooler is abandoned by its author: " + 24756 "https://way-cooler.org/blog/2020/01/09/way-cooler-post-mortem.html"); 24757 24758 - wayfire = callPackage ../applications/window-managers/wayfire { }; 24759 - wcm = callPackage ../applications/window-managers/wayfire/wcm.nix { }; 24760 wf-config = callPackage ../applications/window-managers/wayfire/wf-config.nix { }; 24761 - wf-shell = callPackage ../applications/window-managers/wayfire/wf-shell.nix { }; 24762 24763 waypipe = callPackage ../applications/networking/remote/waypipe { }; 24764
··· 24755 way-cooler = throw ("way-cooler is abandoned by its author: " + 24756 "https://way-cooler.org/blog/2020/01/09/way-cooler-post-mortem.html"); 24757 24758 + wayfireApplications = wayfireApplications-unwrapped.withPlugins (plugins: [ plugins.wf-shell ]); 24759 + inherit (wayfireApplications) wayfire wcm; 24760 + wayfireApplications-unwrapped = callPackage ../applications/window-managers/wayfire/applications.nix { }; 24761 + wayfirePlugins = callPackage ../applications/window-managers/wayfire/plugins.nix { 24762 + inherit (wayfireApplications-unwrapped) wayfire; 24763 + }; 24764 wf-config = callPackage ../applications/window-managers/wayfire/wf-config.nix { }; 24765 24766 waypipe = callPackage ../applications/networking/remote/waypipe { }; 24767