rofi-pass: add rofi-pass plugin for password-store

This commit is contained in:
seylerius 2020-08-03 03:38:22 -05:00 committed by Robert Helgesson
parent 66a68b4a58
commit 1a7f190cb9
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89
9 changed files with 137 additions and 0 deletions

3
.github/CODEOWNERS vendored
View File

@ -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

View File

@ -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";
}];
};
}

View File

@ -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'.
'';
}
];
};
}

View File

@ -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 { })

View File

@ -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";
};
}

View File

@ -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

View File

@ -0,0 +1,4 @@
{
rofi-pass-root = ./rofi-pass-root.nix;
rofi-pass-config = ./rofi-pass-config.nix;
}

View File

@ -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
''
}
'';
};
}

View File

@ -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
''
}
'';
};
}