programs/pop-launcher: revise home-manager module

Now, it assumes it uses a patched version of the pop-launcher where it
includes the store path as one of the search paths for its plugins and
scripts.
This commit is contained in:
Gabriel Arazas 2023-08-21 15:45:55 +08:00
parent b80a0c50aa
commit bdf2208ddf
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -3,29 +3,11 @@
let
cfg = config.programs.pop-launcher;
# This assumes the package contains the built-in plugins being symlinked to
# the main binary with absolute paths. Most sensibly, the nixpkgs builder
# will rewrite symlinks relative to its output directory. Since we're putting
# them outside of its output directory, we'll have to stop it from doing
# that.
package = cfg.package.overrideAttrs (prev: {
dontRewriteSymlinks = true;
});
# Some plugins may be packaged ala-busybox with multiple plugins coming from
# the same binary. Similar reasons as to why we don't want to rewrite
# symlinks with the main package.
plugins = lib.map
(p: p.overrideAttrs (prev: {
dontRewriteSymlinks = true;
}))
cfg.plugins;
# Plugins and scripts are assumed to be packaged at
# `$out/share/pop-launcher`.
pluginsDir = pkgs.symlinkJoin {
name = "pop-launcher-plugins-system";
paths = builtins.map (p: "${p}/share/pop-launcher") (plugins ++ [ package ]);
paths = builtins.map (p: "${p}/share/pop-launcher") cfg.plugins;
};
in
{
@ -49,6 +31,13 @@ in
description = ''
The package where {command}`pop-launcher` binary and
built-in plugins are expected.
::: {.note}
The package is assumed to have been patched to search for the
derivation output path (at `$out/share/pop-launcher`) instead of the
distribution plugins path (at `/usr/lib/pop-launcher`). Otherwise, the
built-in plugins will not show up in the launcher frontend.
:::
'';
default = pkgs.pop-launcher;
};
@ -57,7 +46,9 @@ in
type = lib.types.listOf lib.types.package;
description = ''
List of packages containing Pop launcher plugins and scripts to be
installed as system-wide plugins.
installed as system-wide plugins. The launcher plugins and scripts of
each listed package are assumed to be installed at
`$out/share/pop-launcher`.
'';
default = [ ];
defaultText = "[]";
@ -75,6 +66,6 @@ in
# properly setting in `xdg.dataFile`.
home.file.".local/share/pop-launcher".source = pluginsDir;
home.packages = [ package ];
home.packages = [ cfg.package ];
};
}