nixos/modules/desktop/apps/pass/default.nix

47 lines
997 B
Nix
Raw Normal View History

2023-08-09 19:47:20 +04:00
{
outputs,
options,
config,
lib,
pkgs,
...
}:
2024-08-01 16:24:09 +04:00
let
2023-08-09 19:47:20 +04:00
cfg = config.modules.desktop.apps.pass;
in {
options.modules.desktop.apps.pass = {
2024-08-01 16:24:09 +04:00
enable = lib.mkEnableOption false;
2023-08-09 19:47:20 +04:00
};
2024-08-01 16:24:09 +04:00
config = lib.mkIf cfg.enable {
2023-08-10 02:49:11 +04:00
users.users.sako.packages = with pkgs; [
2024-06-15 12:58:59 +04:00
(pass.withExtensions (pkgs: with pkgs; [pass-otp pass-import pass-genphrase pass-checkup]))
2024-07-04 23:59:01 +04:00
rofi-pass
2023-08-10 02:49:11 +04:00
];
2024-06-15 15:36:38 +04:00
# systemd timer to run git pull and git push
systemd.timers."pass-sync" = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "1m";
OnUnitActiveSec = "1h";
Unit = "pass-sync.service";
};
};
systemd.services."pass-sync" = {
script = ''
set -eu
${pkgs.pass}/bin/pass git pull
${pkgs.pass}/bin/pass git push
2024-07-06 19:20:28 +04:00
${pkgs.libnotify}/bin/notify-send "Passwords synced"
2024-06-15 15:36:38 +04:00
'';
serviceConfig = {
Type = "oneshot";
User = "sako";
};
};
2023-08-10 02:49:11 +04:00
};
2023-08-09 19:47:20 +04:00
}