panacea/modules/periodic.nix

133 lines
4.3 KiB
Nix
Raw Normal View History

2020-08-10 23:45:26 +02:00
{ config, lib, pkgs, ... }:
2021-06-24 12:22:58 +02:00
with pkgs;
let
2022-04-25 06:35:04 +02:00
emacs-vterm = ((emacsPackagesFor emacs28NativeComp).emacsWithPackages
(epkgs: [ epkgs.vterm ]));
isync-oauth2 = isync.overrideAttrs
(div: rec { buildInputs = [ openssl patched-cyrus-sasl-oauth2 zlib ]; });
2021-06-24 12:22:58 +02:00
in {
2020-08-10 23:45:26 +02:00
# Upgrade Doom Emacs daily
systemd.user.services.doom-upgrade = {
description = "Upgrade Doom Emacs";
2021-06-24 12:22:58 +02:00
path = [ bash emacs-vterm git coreutils ];
2020-12-01 14:45:07 +01:00
script = ''
${pkgs.bash}/bin/bash -c "/home/coolneng/.emacs.d/bin/doom -y upgrade"
2020-12-01 14:45:07 +01:00
'';
serviceConfig.Type = "oneshot";
startAt = "22:00:00";
2020-08-10 23:45:26 +02:00
};
# Clean up Doom Emacs monthly
systemd.user.services.doom-purge = {
description = "Purge Doom Emacs";
2021-06-24 12:22:58 +02:00
path = [ bash emacs-vterm git coreutils ];
2020-12-22 00:26:04 +01:00
script = ''
${pkgs.bash}/bin/bash -c "/home/coolneng/.emacs.d/bin/doom -y purge"
2020-12-22 00:26:04 +01:00
'';
serviceConfig.Type = "oneshot";
2021-08-13 21:51:28 +02:00
startAt = "*-*-13 20:00:00";
2020-08-10 23:45:26 +02:00
};
# Upgrade Neovim plugins weekly
systemd.user.services.vim-plug-upgrade = {
description = "Upgrade Vim-Plug";
path = [ git neovim ];
script = "${pkgs.neovim}/bin/nvim +PlugUpgrade +PlugUpdate +qa";
serviceConfig.Type = "oneshot";
startAt = "Wed 18:00:00";
2020-08-10 23:45:26 +02:00
};
# Push password-store changes to git daily
systemd.user.services.password-store-push = {
description = "Push password-store changes to git";
path = [ pass-wayland git gitAndTools.pass-git-helper ];
script = "${pkgs.pass-wayland}/bin/pass git push";
serviceConfig.Type = "oneshot";
startAt = "18:00:00";
};
2021-06-18 16:26:51 +02:00
# Sync mail using IDLE
systemd.user.services.goimapnotify-ugent = {
description = "Sync UGent mail using IMAP IDLE";
2021-06-18 16:26:51 +02:00
wantedBy = [ "default.target" ];
path = [ goimapnotify pass-wayland isync-oauth2 notmuch python39 gnupg ];
2021-06-18 16:26:51 +02:00
script = ''
${pkgs.goimapnotify}/bin/goimapnotify -conf /home/coolneng/.config/goimapnotify/ugent.conf
2021-06-18 16:26:51 +02:00
'';
2021-06-20 17:24:19 +02:00
serviceConfig = {
ExecStartPre = "/home/coolneng/.local/share/scripts/mail-sync ugent";
2021-06-20 17:24:19 +02:00
Type = "simple";
Restart = "always";
RestartSec = 20;
};
2021-06-18 16:26:51 +02:00
after = [ "network.target" ];
};
systemd.user.services.goimapnotify-gmail = {
description = "Sync gmail mail using IMAP IDLE";
wantedBy = [ "default.target" ];
path = [ goimapnotify pass-wayland isync-oauth2 notmuch ];
2021-06-18 16:26:51 +02:00
script = ''
${pkgs.goimapnotify}/bin/goimapnotify -conf /home/coolneng/.config/goimapnotify/gmail.conf
'';
2021-06-20 17:24:19 +02:00
serviceConfig = {
ExecStartPre = "/home/coolneng/.local/share/scripts/mail-sync gmail";
2021-06-20 17:24:19 +02:00
Type = "simple";
Restart = "always";
2022-04-12 00:33:58 +02:00
RestartSec = 20;
};
after = [ "network.target" ];
};
systemd.user.services.goimapnotify-disroot = {
description = "Sync disroot mail using IMAP IDLE";
wantedBy = [ "default.target" ];
path = [ goimapnotify pass-wayland isync-oauth2 notmuch ];
script = ''
${pkgs.goimapnotify}/bin/goimapnotify -conf /home/coolneng/.config/goimapnotify/disroot.conf
'';
serviceConfig = {
ExecStartPre = "/home/coolneng/.local/share/scripts/mail-sync disroot";
Type = "simple";
Restart = "always";
2021-06-20 17:24:19 +02:00
RestartSec = 20;
};
2021-06-18 16:26:51 +02:00
after = [ "network.target" ];
};
# Garbage collect git repositories on a monthly basis
systemd.user.services.git-gc = {
description = "Garbage collect git repositories";
path = [ git fd ];
script = ''
2022-04-15 04:31:31 +02:00
${pkgs.fd}/bin/fd -g -H --type directory '.git' /home/coolneng/Documents/* --exec git -C '{}' gc
${pkgs.fd}/bin/fd -g -H --type directory '.git' /home/coolneng/Projects --exec git -C '{}' gc
${pkgs.fd}/bin/fd -g -H --type directory '.git' /home/coolneng/Repos --exec git -C '{}' gc
'';
serviceConfig.Type = "oneshot";
startAt = "*-*-13 17:00:00";
};
# HACK Change home partition permissions for mopidy
systemd.services.chmod-home = {
description = "Change home partition permissions for Mopidy";
wantedBy = [ "default.target" ];
script = "chmod 751 /home/coolneng";
serviceConfig.Type = "oneshot";
after = [ "home-coolneng.mount" ];
before = [ "mopidy.service" "mopidy-scan.service" ];
};
2022-05-02 00:46:17 +02:00
# Push panacea changes to git daily
systemd.user.services.panacea-push = {
description = "Push panacea changes to git";
path = [ git gitAndTools.pass-git-helper ];
script = "${pkgs.git}/bin/git push";
serviceConfig.Type = "oneshot";
startAt = "14:00:00";
};
2020-08-10 23:45:26 +02:00
}