From 189ed9d2138d7cc9557f372c036e2f892eeefd3e Mon Sep 17 00:00:00 2001 From: t4ccer Date: Thu, 17 Jun 2021 12:28:26 +0200 Subject: [PATCH 1/5] rofi: add support to plugins --- modules/programs/rofi.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/programs/rofi.nix b/modules/programs/rofi.nix index 9c6badbfd244..a8f2c6af2caf 100644 --- a/modules/programs/rofi.nix +++ b/modules/programs/rofi.nix @@ -207,6 +207,17 @@ 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 +416,10 @@ in { inherit value; }; - home.packages = [ cfg.package ]; + home.packages = let + rofiWithPlugins = cfg.package.override + (old: rec { plugins = (old.plugins or [ ]) ++ cfg.plugins; }); + in [ rofiWithPlugins ]; home.file."${cfg.configPath}".text = toRasi { configuration = ({ From 4ca82b8f9dbfdef2444b28fc19290e22781abfe3 Mon Sep 17 00:00:00 2001 From: t4ccer <64430288+t4ccer@users.noreply.github.com> Date: Fri, 18 Jun 2021 00:34:19 +0200 Subject: [PATCH 2/5] rofi: update package example Co-authored-by: Sumner Evans --- modules/programs/rofi.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/programs/rofi.nix b/modules/programs/rofi.nix index a8f2c6af2caf..5e298686a296 100644 --- a/modules/programs/rofi.nix +++ b/modules/programs/rofi.nix @@ -213,9 +213,7 @@ in { description = '' List of rofi plugins to be installed. ''; - example = literalExample '' - [ pkgs.rofi-calc ]; - ''; + example = literalExample ''[ pkgs.rofi-calc ]''; }; width = mkOption { From 0e7ddcef97d6d104c0fa2ab1fc9a41e33d0587fb Mon Sep 17 00:00:00 2001 From: t4ccer Date: Sat, 19 Jun 2021 16:12:04 +0200 Subject: [PATCH 3/5] rofi: Format package example --- modules/programs/rofi.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/rofi.nix b/modules/programs/rofi.nix index 5e298686a296..30a549bbc922 100644 --- a/modules/programs/rofi.nix +++ b/modules/programs/rofi.nix @@ -213,7 +213,7 @@ in { description = '' List of rofi plugins to be installed. ''; - example = literalExample ''[ pkgs.rofi-calc ]''; + example = literalExample "[ pkgs.rofi-calc ]"; }; width = mkOption { From b599efdd94ca894efa9ede8d8d50194e619b1705 Mon Sep 17 00:00:00 2001 From: t4ccer Date: Sat, 19 Jun 2021 16:12:23 +0200 Subject: [PATCH 4/5] rofi: Fix tests Rofi will not try to install plugins using override when tests overlay actual rofi package with empty scirpt --- modules/programs/rofi.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/programs/rofi.nix b/modules/programs/rofi.nix index 30a549bbc922..76b0fa0f23f1 100644 --- a/modules/programs/rofi.nix +++ b/modules/programs/rofi.nix @@ -417,7 +417,10 @@ in { home.packages = let rofiWithPlugins = cfg.package.override (old: rec { plugins = (old.plugins or [ ]) ++ cfg.plugins; }); - in [ rofiWithPlugins ]; + in if builtins.hasAttr "override" cfg.package then + [ rofiWithPlugins ] + else + [ cfg.package ]; home.file."${cfg.configPath}".text = toRasi { configuration = ({ From 68101da1eb63a84f9883da76cdd6f5a90ce23051 Mon Sep 17 00:00:00 2001 From: t4ccer Date: Tue, 29 Jun 2021 18:15:01 +0200 Subject: [PATCH 5/5] rofi: Refactor --- modules/programs/rofi.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/programs/rofi.nix b/modules/programs/rofi.nix index 76b0fa0f23f1..f4f7594e136c 100644 --- a/modules/programs/rofi.nix +++ b/modules/programs/rofi.nix @@ -417,10 +417,11 @@ in { home.packages = let rofiWithPlugins = cfg.package.override (old: rec { plugins = (old.plugins or [ ]) ++ cfg.plugins; }); - in if builtins.hasAttr "override" cfg.package then - [ rofiWithPlugins ] - else - [ cfg.package ]; + rofiPackage = if builtins.hasAttr "override" cfg.package then + rofiWithPlugins + else + cfg.package; + in [ rofiPackage ]; home.file."${cfg.configPath}".text = toRasi { configuration = ({