wayfire: refactor

1
This commit is contained in:
rewine 2023-07-16 23:04:25 +08:00 committed by Anderson Torres
parent 246e73daad
commit 8974e68bef
4 changed files with 45 additions and 76 deletions

View file

@ -1,20 +0,0 @@
{ lib, newScope, wayfirePlugins }:
lib.makeExtensible (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;
};
})

View file

@ -1,13 +1,11 @@
{ newScope, wayfire }:
{ lib, pkgs }:
let
self = with self; {
inherit wayfire;
callPackage = newScope self;
wf-shell = callPackage ./wf-shell.nix { };
lib.makeScope pkgs.newScope (self:
let
inherit (self) callPackage;
in {
wayfire-plugins-extra = callPackage ./wayfire-plugins-extra.nix { };
};
in
self
wcm = callPackage ./wcm.nix { };
wf-shell = callPackage ./wf-shell.nix { };
}
)

View file

@ -1,39 +1,32 @@
{ runCommand, lib, makeWrapper, wayfirePlugins }:
{ symlinkJoin, lib, makeWrapper, wayfire, plugins ? [ ] }:
let
inherit (lib) escapeShellArg makeBinPath;
symlinkJoin {
name = "wayfire-wrapped-${lib.getVersion wayfire}";
xmlPath = plugin: "${plugin}/share/wayfire/metadata/wf-shell";
makePluginPath = lib.makeLibraryPath;
makePluginXMLPath = lib.concatMapStringsSep ":" xmlPath;
in
application:
choosePlugins:
let
plugins = choosePlugins wayfirePlugins;
in
runCommand "${application.name}-wrapped" {
nativeBuildInputs = [ makeWrapper ];
passthru = application.passthru // {
unwrapped = application;
paths = [
wayfire
] ++ plugins;
postBuild = ''
for binary in $out/bin/*; do
wrapProgram $binary \
--prefix WAYFIRE_PLUGIN_PATH : $out/lib/wayfire \
--prefix WAYFIRE_PLUGIN_XML_PATH : $out/share/wayfire/metadata
done
'';
preferLocalBuild = true;
passthru = wayfire.passthru // {
unwrapped = wayfire;
};
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 ';'
''
meta = wayfire.meta // {
# To prevent builds on hydra
hydraPlatforms = [];
# prefer wrapper over the package
priority = (wayfire.meta.priority or 0) - 1;
};
}

View file

@ -36005,22 +36005,20 @@ with pkgs;
wapiti = callPackage ../tools/security/wapiti { };
wayfireApplications = wayfireApplications-unwrapped.withPlugins (plugins: [ plugins.wf-shell plugins.wayfire-plugins-extra ]);
inherit (wayfireApplications) wayfire wcm;
wayfireApplications-unwrapped = recurseIntoAttrs (
(callPackage ../applications/window-managers/wayfire/applications.nix { }).
extend (_: _: { wlroots = wlroots_0_16; })
);
wayfirePlugins = recurseIntoAttrs (
callPackage ../applications/window-managers/wayfire/plugins.nix {
inherit (wayfireApplications-unwrapped) wayfire;
}
);
weave-gitops = callPackage ../applications/networking/cluster/weave-gitops { };
wayfire = callPackage ../applications/window-managers/wayfire/default.nix {
wlroots = wlroots_0_16;
};
wf-config = callPackage ../applications/window-managers/wayfire/wf-config.nix { };
wayfirePlugins = recurseIntoAttrs (
callPackage ../applications/window-managers/wayfire/plugins.nix { }
);
wayfire-with-plugins = callPackage ../applications/window-managers/wayfire/wrapper.nix {
plugins = with wayfirePlugins; [ wcm wf-shell ];
};
waypipe = callPackage ../applications/networking/remote/waypipe { };
wayv = callPackage ../tools/X11/wayv { };