summaryrefslogtreecommitdiffstats
path: root/pkgs/applications/window-managers
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-05-02 18:08:22 +0000
committerAlyssa Ross <hi@alyssa.is>2020-12-19 01:41:29 +0000
commitc898defdbf6867dc3e90ab683375d409a66d357d (patch)
treea124f94e3c41ce1017d9c771322a7364c35535c4 /pkgs/applications/window-managers
parente2243140f98bf692e24ce9972e803d17d29ffd1b (diff)
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.
Diffstat (limited to 'pkgs/applications/window-managers')
-rw-r--r--pkgs/applications/window-managers/wayfire/applications.nix23
-rw-r--r--pkgs/applications/window-managers/wayfire/plugins.nix12
-rw-r--r--pkgs/applications/window-managers/wayfire/wrapper.nix39
3 files changed, 74 insertions, 0 deletions
diff --git a/pkgs/applications/window-managers/wayfire/applications.nix b/pkgs/applications/window-managers/wayfire/applications.nix
new file mode 100644
index 000000000000..6c22227c0c51
--- /dev/null
+++ b/pkgs/applications/window-managers/wayfire/applications.nix
@@ -0,0 +1,23 @@
+{ newScope, wayfirePlugins }:
+
+let
+ self = with self; {
+ inherit wayfirePlugins;
+
+ callPackage = newScope self;
+
+ wayfire = callPackage ./. { };
+
+ wcm = callPackage ./wcm.nix {
+ inherit (wayfirePlugins) wf-shell;
+ };
+
+ wrapWayfireApplication = callPackage ./wrapper.nix { };
+
+ withPlugins = selector: self // {
+ wayfire = wrapWayfireApplication wayfire selector;
+ wcm = wrapWayfireApplication wcm selector;
+ };
+ };
+in
+self
diff --git a/pkgs/applications/window-managers/wayfire/plugins.nix b/pkgs/applications/window-managers/wayfire/plugins.nix
new file mode 100644
index 000000000000..830a918fcb7e
--- /dev/null
+++ b/pkgs/applications/window-managers/wayfire/plugins.nix
@@ -0,0 +1,12 @@
+{ newScope, wayfire }:
+
+let
+ self = with self; {
+ inherit wayfire;
+
+ callPackage = newScope self;
+
+ wf-shell = callPackage ./wf-shell.nix { };
+ };
+in
+self
diff --git a/pkgs/applications/window-managers/wayfire/wrapper.nix b/pkgs/applications/window-managers/wayfire/wrapper.nix
new file mode 100644
index 000000000000..622928985471
--- /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 ';'
+''