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

(cherry picked from commit 1a7f190cb9)
This commit is contained in:
seylerius 2020-08-03 03:38:22 -05:00 committed by Robert Helgesson
parent feb7455112
commit a4f41474b0
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

@ -117,6 +117,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

@ -31,4 +31,14 @@
github = "olmokramer";
githubId = 3612514;
};
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

@ -1728,6 +1728,13 @@ in
A new module is available: 'services.caffeine'.
'';
}
{
time = "2020-12-18T22:22:25+00:00";
message = ''
A new module is available: 'programs.rofi.pass'.
'';
}
];
};
}

View file

@ -112,6 +112,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

@ -88,6 +88,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
''
}
'';
};
}