systemd-services.nix (1396B)
1 { pkgs, ... }: 2 { 3 systemd.user = { 4 startServices = "sd-switch"; 5 services.mbsync = { 6 Unit = { 7 Description = "Mailbox sync service"; 8 RefuseManualStart = "no"; 9 RefuseManualStop = "yes"; 10 }; 11 Service = { 12 Type = "oneshot"; 13 ExecStart = "${pkgs.zsh}/bin/zsh -c 'mbsync -c .config/isync/mbsyncrc -a -q'"; 14 }; 15 Install = { 16 wantedBy = [ "default.target" ]; 17 }; 18 }; 19 timers.mbsync = { 20 Unit = { 21 Description = "Mailbox sync timer"; 22 RefuseManualStop = "no"; 23 RefuseManualStart = "no"; 24 }; 25 Timer = { 26 Persistent = false; 27 OnBootSec = "0.3m"; 28 OnUnitActiveSec = "0.5m"; 29 Unit = "mbsync.service"; 30 }; 31 Install = { 32 WantedBy = [ "timers.target" ]; 33 }; 34 }; 35 services.niri-wakeup-monitors = { 36 Unit = { 37 Description = "Wake up external monitors after resume (niri)"; 38 After = [ 39 "suspend.target" 40 "hibernate.target" 41 "systemd-suspend-then-hibernate.target" 42 ]; 43 }; 44 45 Service = { 46 Type = "oneshot"; 47 ExecStart = "${pkgs.zsh}/bin/zsh -c 'niri-wakeup-monitors'"; 48 }; 49 50 Install = { 51 WantedBy = [ 52 "suspend.target" 53 "hibernate.target" 54 "systemd-suspend-then-hibernate.target" 55 ]; 56 }; 57 }; 58 }; 59 }