nixos-config/home/rbw.nix

57 lines
1.4 KiB
Nix
Raw Permalink Normal View History

2022-04-10 11:54:58 +02:00
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
2022-04-09 22:23:25 +02:00
mkEnableOption
mkIf
2022-04-10 11:54:58 +02:00
;
2022-04-09 22:23:25 +02:00
cfg = config.my.home.mail;
2022-04-10 11:54:58 +02:00
in {
2022-04-09 22:23:25 +02:00
options.my.home.rbw = {
2022-04-10 11:54:58 +02:00
enable = mkEnableOption "rbw configuration";
2022-04-09 22:23:25 +02:00
};
config = mkIf cfg.enable {
programs.rbw = {
enable = true;
settings = {
email = "antoine@alarsyo.net";
base_url = "https://pass.alarsyo.net";
lock_timeout = 60 * 60 * 12;
2022-12-12 15:22:58 +01:00
pinentry = pkgs.pinentry-qt;
2022-04-09 22:23:25 +02:00
};
};
2022-04-11 17:15:32 +02:00
# `rbw-agent` should be launched on first call to `rbw`, so this shouldn't
# be necessary.
#
# However, if for instance `rbw` if first called by the emacs-daemon (when
# accessing an IMAP account password), then restarting the user service
# associated to the emacs daemon also kills the rbw-agent it spawned,
# resetting the lock status and prompting for a passphrase again.
#
# This user service makes sure the rbw-agent is started when the user
# session launches.
systemd.user.services.rbw = {
Unit = {
Description = "rbw agent autostart";
After = "graphical-session.target";
PartOf = "graphical-session.target";
};
2022-04-11 17:15:32 +02:00
Install.WantedBy = ["graphical-session.target"];
2022-04-11 17:15:32 +02:00
Service = {
ExecStart = "${pkgs.rbw}/bin/rbw-agent";
Restart = "on-abort";
Type = "forking";
PIDFile = "%t/rbw/pidfile";
};
};
2022-04-09 22:23:25 +02:00
};
}