git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commitc898defdbf6867dc3e90ab683375d409a66d357d authorAlyssa Ross <hi@alyssa.is> dateSat 2 May 2020, 18:08 (7 years ago) parente224314
4 files changed+80−3
pkgs/applications/window-managers/wayfire/applications.nix+23 pkgs/applications/window-managers/wayfire/plugins.nix+12 pkgs/applications/window-managers/wayfire/wrapper.nix+39 pkgs/top-level/all-packages.nix+6−3
pkgs/applications/window-managers/wayfire/applications.nixnew file+23
@@ -0,0 +1,23 @@
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
pkgs/applications/window-managers/wayfire/plugins.nixnew file+12
@@ -0,0 +1,12 @@
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
pkgs/applications/window-managers/wayfire/wrapper.nixnew file+39
@@ -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+''
pkgs/top-level/all-packages.nix+6−3
@@ -24755,10 +24755,13 @@ in
2475524755 way-cooler = throw ("way-cooler is abandoned by its author: " +
2475624756 "https://way-cooler.org/blog/2020/01/09/way-cooler-post-mortem.html");
2475724757
24758− wayfire = callPackage ../applications/window-managers/wayfire { };
24759− wcm = callPackage ../applications/window-managers/wayfire/wcm.nix { };
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+ };
2476024764 wf-config = callPackage ../applications/window-managers/wayfire/wf-config.nix { };
24761− wf-shell = callPackage ../applications/window-managers/wayfire/wf-shell.nix { };
2476224765
2476324766 waypipe = callPackage ../applications/networking/remote/waypipe { };
2476424767