programs/pop-launcher: update NixOS module

Now it assumes the package is patched to search its plugins and scripts
on its store path.
This commit is contained in:
Gabriel Arazas 2023-08-22 09:18:58 +08:00
parent d8263334c0
commit 08202d1bab
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -3,28 +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 busybox-style with multiple plugins in one
# binary.
plugins = lib.lists.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
{
@ -48,6 +31,14 @@ 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 {file}`$out/share/pop-launcher`) instead of
the distribution plugins path (at {file}`/usr/lib/pop-launcher`).
Otherwise, the built-in plugins will not show up in the launcher
frontend.
:::
'';
default = pkgs.pop-launcher;
};
@ -56,7 +47,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
{file}`$out/share/pop-launcher`.
'';
default = [ ];
defaultText = "[]";
@ -72,6 +65,6 @@ in
config = lib.mkIf cfg.enable {
environment.etc.pop-launcher.source = pluginsDir;
environment.systemPackages = [ package ];
environment.systemPackages = [ cfg.package ];
};
}