From ae96c9dd78e31c3f7433a2333e6bced79face762 Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Sat, 15 Jun 2024 11:36:38 +0000 Subject: [PATCH] add pass-sync timer --- config/emacs/emacs.org | 18 +++++++++--------- modules/desktop/apps/pass/default.nix | 23 +++++++++++++++++++++++ 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/config/emacs/emacs.org b/config/emacs/emacs.org index 1d83c780..c536e7e9 100644 --- a/config/emacs/emacs.org +++ b/config/emacs/emacs.org @@ -540,16 +540,16 @@ TODO #+end_src ** Password-Store #+begin_src emacs-lisp -(use-package password-store - :bind (("C-c p p" . password-store-copy) - ("C-c p i" . password-store-insert) - ("C-c p g" . password-store-generate)) - :config - (setq password-store-password-length 12)) + (use-package password-store + :bind (("C-c p p" . password-store-copy) + ("C-c p i" . password-store-insert) + ("C-c p g" . password-store-generate)) + :config + (setq password-store-password-length 12)) -(use-package auth-source-pass - :config - (auth-source-pass-enable)) + (use-package auth-source-pass + :config + (auth-source-pass-enable)) #+end_src ** OAuth2 this should be useful later diff --git a/modules/desktop/apps/pass/default.nix b/modules/desktop/apps/pass/default.nix index fa0f8ef5..7974a645 100644 --- a/modules/desktop/apps/pass/default.nix +++ b/modules/desktop/apps/pass/default.nix @@ -17,5 +17,28 @@ in { users.users.sako.packages = with pkgs; [ (pass.withExtensions (pkgs: with pkgs; [pass-otp pass-import pass-genphrase pass-checkup])) ]; + + # 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.coreutils}/bin/echo "Hello World" + ${pkgs.pass}/bin/pass git pull + ${pkgs.pass}/bin/pass git push + ''; + serviceConfig = { + Type = "oneshot"; + User = "sako"; + }; + }; }; }