rofi: add finalPackage option (#2649)

This makes it possible to use the customized rofi binary in Sway keybindings for instance.
This commit is contained in:
Nicolas Berbiche 2022-01-17 18:21:40 -05:00 committed by GitHub
parent 9bceb8292e
commit b59752b9ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -115,6 +115,14 @@ in {
'';
};
finalPackage = mkOption {
type = types.package;
readOnly = true;
description = ''
Resulting customized rofi package.
'';
};
plugins = mkOption {
default = [ ];
type = types.listOf types.package;
@ -254,14 +262,15 @@ in {
inherit value;
};
home.packages = let
programs.rofi.finalPackage = 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 ];
in if builtins.hasAttr "override" cfg.package then
rofiWithPlugins
else
cfg.package;
home.packages = [ cfg.finalPackage ];
home.file."${cfg.configPath}".text = toRasi {
configuration = ({