aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseylerius <sable@seyleri.us>2020-08-03 03:38:22 -0500
committerRobert Helgesson <robert@rycee.net>2020-12-18 23:22:57 +0100
commit1a7f190cb9b4176ceb5bab43a6803c3fb015671a (patch)
tree353b484592a4b944dc1867b93d1cb1c61a44c26e
parent66a68b4a58f7c554bd7746acd51ff7cc02840b0a (diff)
rofi-pass: add rofi-pass plugin for password-store
-rw-r--r--.github/CODEOWNERS3
-rw-r--r--modules/lib/maintainers.nix10
-rw-r--r--modules/misc/news.nix7
-rw-r--r--modules/modules.nix1
-rw-r--r--modules/programs/rofi-pass.nix46
-rw-r--r--tests/default.nix1
-rw-r--r--tests/modules/programs/rofi-pass/default.nix4
-rw-r--r--tests/modules/programs/rofi-pass/rofi-pass-config.nix35
-rw-r--r--tests/modules/programs/rofi-pass/rofi-pass-root.nix30
9 files changed, 137 insertions, 0 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 4a66e1a7805e..54be54fb80b0 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -119,6 +119,9 @@
/modules/programs/powerline-go.nix @DamienCassou
+/modules/programs/rofi-pass.nix @seylerius
+/tests/modules/programs/rofi-pass @seylerius
+
/modules/programs/rtorrent.nix @marsam
/modules/programs/ssh.nix @rycee
diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix
index 715b5b0bbc50..de1808015cef 100644
--- a/modules/lib/maintainers.nix
+++ b/modules/lib/maintainers.nix
@@ -37,4 +37,14 @@
github = "matrss";
githubId = 9308656;
};
+ seylerius = {
+ email = "sable@seyleri.us";
+ name = "Sable Seyler";
+ github = "seylerius";
+ githubId = 1145981;
+ keys = [{
+ logkeyid = "rsa4096/0x68BF2EAE6D91CAFF";
+ fingerprint = "F0E0 0311 126A CD72 4392 25E6 68BF 2EAE 6D91 CAFF";
+ }];
+ };
}
diff --git a/modules/misc/news.nix b/modules/misc/news.nix
index 1cab8d89b0b1..db2a15abd56e 100644
--- a/modules/misc/news.nix
+++ b/modules/misc/news.nix
@@ -1775,6 +1775,13 @@ in
A new module is available: 'services.pbgopy'.
'';
}
+
+ {
+ time = "2020-12-18T22:22:25+00:00";
+ message = ''
+ A new module is available: 'programs.rofi.pass'.
+ '';
+ }
];
};
}
diff --git a/modules/modules.nix b/modules/modules.nix
index 8ecdc462aeb9..292037d93194 100644
--- a/modules/modules.nix
+++ b/modules/modules.nix
@@ -113,6 +113,7 @@ let
(loadModule ./programs/qutebrowser.nix { })
(loadModule ./programs/readline.nix { })
(loadModule ./programs/rofi.nix { })
+ (loadModule ./programs/rofi-pass.nix { })
(loadModule ./programs/rtorrent.nix { })
(loadModule ./programs/skim.nix { })
(loadModule ./programs/starship.nix { })
diff --git a/modules/programs/rofi-pass.nix b/modules/programs/rofi-pass.nix
new file mode 100644
index 000000000000..da75299e6736
--- /dev/null
+++ b/modules/programs/rofi-pass.nix
@@ -0,0 +1,46 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.programs.rofi.pass;
+
+in {
+ meta.maintainers = [ maintainers.seylerius ];
+
+ options.programs.rofi.pass = {
+ enable = mkEnableOption "rofi integration with password-store";
+
+ stores = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ description = ''
+ Directory roots of your password-stores.
+ '';
+ };
+
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ example = ''
+ URL_field='url'
+ USERNAME_field='user'
+ AUTOTYPE_field='autotype'
+ '';
+ description = ''
+ Extra configuration to be added at to the rofi-pass config file.
+ Additional examples can be found at
+ <link xlink:href="https://github.com/carnager/rofi-pass/blob/master/config.example"/>.
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+ home.packages = [ pkgs.rofi-pass ];
+
+ xdg.configFile."rofi-pass/config".text = optionalString (cfg.stores != [ ])
+ ("root=" + (concatStringsSep ":" cfg.stores) + "\n") + cfg.extraConfig
+ + optionalString (cfg.extraConfig != "") "\n";
+ };
+}
diff --git a/tests/default.nix b/tests/default.nix
index 1bc54ec9bc45..0cfa26bbccba 100644
--- a/tests/default.nix
+++ b/tests/default.nix
@@ -89,6 +89,7 @@ import nmt {
./modules/programs/ncmpcpp-linux
./modules/programs/neovim # Broken package dependency on Darwin.
./modules/programs/rofi
+ ./modules/programs/rofi-pass
./modules/programs/waybar
./modules/services/dropbox
./modules/services/emacs
diff --git a/tests/modules/programs/rofi-pass/default.nix b/tests/modules/programs/rofi-pass/default.nix
new file mode 100644
index 000000000000..181aef4e129c
--- /dev/null
+++ b/tests/modules/programs/rofi-pass/default.nix
@@ -0,0 +1,4 @@
+{
+ rofi-pass-root = ./rofi-pass-root.nix;
+ rofi-pass-config = ./rofi-pass-config.nix;
+}
diff --git a/tests/modules/programs/rofi-pass/rofi-pass-config.nix b/tests/modules/programs/rofi-pass/rofi-pass-config.nix
new file mode 100644
index 000000000000..e70ad9ab1605
--- /dev/null
+++ b/tests/modules/programs/rofi-pass/rofi-pass-config.nix
@@ -0,0 +1,35 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+ config = {
+ programs.rofi = {
+ enable = true;
+
+ pass = {
+ enable = true;
+ extraConfig = ''
+ # Extra config for rofi-pass
+ xdotool_delay=12
+ '';
+ };
+ };
+
+ nixpkgs.overlays = [
+ (self: super: { rofi-pass = pkgs.writeScriptBin "dummy-rofi-pass" ""; })
+ ];
+
+ nmt.script = ''
+ assertFileContent \
+ home-files/.config/rofi-pass/config \
+ ${
+ pkgs.writeText "rofi-pass-expected-config" ''
+ # Extra config for rofi-pass
+ xdotool_delay=12
+
+ ''
+ }
+ '';
+ };
+}
diff --git a/tests/modules/programs/rofi-pass/rofi-pass-root.nix b/tests/modules/programs/rofi-pass/rofi-pass-root.nix
new file mode 100644
index 000000000000..15c86ef6293c
--- /dev/null
+++ b/tests/modules/programs/rofi-pass/rofi-pass-root.nix
@@ -0,0 +1,30 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+ config = {
+ programs.rofi = {
+ enable = true;
+
+ pass = {
+ enable = true;
+ stores = [ "~/.local/share/password-store" ];
+ };
+ };
+
+ nixpkgs.overlays = [
+ (self: super: { rofi-pass = pkgs.writeScriptBin "dummy-rofi-pass" ""; })
+ ];
+
+ nmt.script = ''
+ assertFileContent \
+ home-files/.config/rofi-pass/config \
+ ${
+ pkgs.writeText "rofi-pass-expected-config" ''
+ root=~/.local/share/password-store
+ ''
+ }
+ '';
+ };
+}