From e721037820e0876a18b9ad6e975deaa7028162c1 Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Fri, 29 Oct 2021 19:57:57 +0300 Subject: [PATCH] Add password store sync --- modules/secrets.nix | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/modules/secrets.nix b/modules/secrets.nix index 9973a26..cfa30d6 100755 --- a/modules/secrets.nix +++ b/modules/secrets.nix @@ -149,6 +149,29 @@ in { }; Install.WantedBy = [ "graphical-session-pre.target" ]; }; + systemd.user.services.pass-store-sync = { + Service = { + Environment = [ + "PASSWORD_STORE_DIR=${password-store}" + "PATH=${lib.makeBinPath [ pkgs.pass pkgs.inotify-tools pkgs.gnupg ]}" + ]; + ExecStart = toString (pkgs.writeShellScript "pass-store-sync" '' + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + while inotifywait "$PASSWORD_STORE_DIR" -r -e move -e close_write -e create -e delete --exclude .git; do + sleep 0.1 + pass git add --all + pass git commit -m "Change" + pass git pull --rebase + pass git push + done + ''); + }; + Unit = rec { + After = [ "activate-secrets.service" ]; + Wants = After; + }; + Install.WantedBy = [ "graphical-session-pre.target" ]; + }; programs.password-store = { enable = true; package = pkgs.pass-wayland;