aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/home-manager/modules/programs/rofi-pass.nix
blob: da75299e67365693563aabc353b2f219e7592807 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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";
  };
}