rofi: add "plugins" option (#2117)

* rofi: add support to plugins

* rofi: update package example

Co-authored-by: Sumner Evans <me@sumnerevans.com>

* rofi: Format package example

* rofi: Fix tests

Rofi will not try to install plugins using override when tests overlay
actual rofi package with empty scirpt

* rofi: Refactor

Co-authored-by: Sumner Evans <me@sumnerevans.com>
This commit is contained in:
t4ccer 2021-06-29 19:13:01 +02:00 committed by GitHub
parent 9b7a90daa1
commit 5b08b33e8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -207,6 +207,15 @@ in {
'';
};
plugins = mkOption {
default = [ ];
type = types.listOf types.package;
description = ''
List of rofi plugins to be installed.
'';
example = literalExample "[ pkgs.rofi-calc ]";
};
width = mkOption {
default = null;
type = types.nullOr types.int;
@ -405,7 +414,14 @@ in {
inherit value;
};
home.packages = [ cfg.package ];
home.packages = let
rofiWithPlugins = cfg.package.override
(old: rec { plugins = (old.plugins or [ ]) ++ cfg.plugins; });
rofiPackage = if builtins.hasAttr "override" cfg.package then
rofiWithPlugins
else
cfg.package;
in [ rofiPackage ];
home.file."${cfg.configPath}".text = toRasi {
configuration = ({