summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2025-03-16 18:22:51 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2025-03-16 18:22:51 +0100
commit00c5b668482614254df95e617396c787cf66e8f6 (patch)
treee65a2c6ece8002ec9a5e6b35f17af51ed4a731d2 /accounts/gkleen@sif
parent73737bbdd193ea946899f52a59efb513131fedd2 (diff)
downloadnixos-00c5b668482614254df95e617396c787cf66e8f6.tar
nixos-00c5b668482614254df95e617396c787cf66e8f6.tar.gz
nixos-00c5b668482614254df95e617396c787cf66e8f6.tar.bz2
nixos-00c5b668482614254df95e617396c787cf66e8f6.tar.xz
nixos-00c5b668482614254df95e617396c787cf66e8f6.zip
...
Diffstat (limited to 'accounts/gkleen@sif')
-rw-r--r--accounts/gkleen@sif/systemd.nix28
1 files changed, 19 insertions, 9 deletions
diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix
index 99cbcbb3..48352208 100644
--- a/accounts/gkleen@sif/systemd.nix
+++ b/accounts/gkleen@sif/systemd.nix
@@ -46,11 +46,11 @@ in {
46 ]; 46 ];
47 47
48 services = { 48 services = {
49 sync-keepass = { 49 "sync-keepass@" = {
50 Service = { 50 Service = {
51 Type = "oneshot"; 51 Type = "oneshot";
52 WorkingDirectory = "~"; 52 WorkingDirectory = "~";
53 ExecStart = toString (pkgs.writers.writePython3 "sync-keepass" { 53 ExecStart = "${pkgs.writers.writePython3 "sync-keepass" {
54 libraries = with pkgs.python3Packages; [ python-dateutil ]; 54 libraries = with pkgs.python3Packages; [ python-dateutil ];
55 } '' 55 } ''
56 import json 56 import json
@@ -59,13 +59,13 @@ in {
59 from datetime import datetime 59 from datetime import datetime
60 from dateutil.tz import tzlocal 60 from dateutil.tz import tzlocal
61 from dateutil.parser import isoparse 61 from dateutil.parser import isoparse
62 from sys import stderr 62 from sys import stderr, argv
63 63
64 64
65 remote_fs = 'surtr' 65 remote_fs = 'surtr' if argv[1] == 'store.kdbx' else 'mathcloud'
66 remote_file = 'store.kdbx' 66 remote_file = argv[1]
67 target_file = expanduser('~/store.kdbx') 67 target_file = expanduser(f'~/{argv[1]}')
68 meta_file = expanduser('~/.store.kdbx.json') 68 meta_file = expanduser(f'~/.{argv[1]}.json')
69 69
70 upload_time = None 70 upload_time = None
71 our_last_upload_time = None 71 our_last_upload_time = None
@@ -115,7 +115,7 @@ in {
115 do_upload() 115 do_upload()
116 elif upload_time is not None and (mod_time is None or upload_time > mod_time) and (our_last_upload_time is None or upload_time > our_last_upload_time): # noqa: E501 116 elif upload_time is not None and (mod_time is None or upload_time > mod_time) and (our_last_upload_time is None or upload_time > our_last_upload_time): # noqa: E501
117 do_download() 117 do_download()
118 ''); 118 ''} \"%I\"";
119 Environment = [ "RCLONE_PASSWORD_COMMAND=\"${pkgs.coreutils}/bin/cat ${config.sops.secrets.gkleen-rclone.path}\"" "PATH=${pkgs.rclone}/bin" ]; 119 Environment = [ "RCLONE_PASSWORD_COMMAND=\"${pkgs.coreutils}/bin/cat ${config.sops.secrets.gkleen-rclone.path}\"" "PATH=${pkgs.rclone}/bin" ];
120 }; 120 };
121 }; 121 };
@@ -408,7 +408,7 @@ in {
408 }; 408 };
409 }; 409 };
410 timers = { 410 timers = {
411 sync-keepass = { 411 "sync-keepass@store.kdbx" = {
412 Timer = { 412 Timer = {
413 OnActiveSec = "1m"; 413 OnActiveSec = "1m";
414 OnUnitActiveSec = "1m"; 414 OnUnitActiveSec = "1m";
@@ -418,6 +418,16 @@ in {
418 WantedBy = ["default.target"]; 418 WantedBy = ["default.target"];
419 }; 419 };
420 }; 420 };
421 "sync-keepass@rz.kdbx" = {
422 Timer = {
423 OnActiveSec = "3h";
424 OnUnitActiveSec = "3h";
425 };
426
427 Install = {
428 WantedBy = ["default.target"];
429 };
430 };
421 }; 431 };
422 targets = { 432 targets = {
423 graphical-session = { 433 graphical-session = {