From 5b08b33e8fcd4737edca0f187e47033b1b206114 Mon Sep 17 00:00:00 2001 From: t4ccer <64430288+t4ccer@users.noreply.github.com> Date: Tue, 29 Jun 2021 19:13:01 +0200 Subject: [PATCH] rofi: add "plugins" option (#2117) * rofi: add support to plugins * rofi: update package example Co-authored-by: Sumner Evans * 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 --- modules/programs/rofi.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/programs/rofi.nix b/modules/programs/rofi.nix index 9c6badbfd..f4f7594e1 100644 --- a/modules/programs/rofi.nix +++ b/modules/programs/rofi.nix @@ -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 = ({