From f6e9fca1581389376d94b72245aa89e1bef8bad7 Mon Sep 17 00:00:00 2001 From: coolneng Date: Mon, 10 Aug 2020 23:45:26 +0200 Subject: [PATCH] Move user services to a new file --- configuration.nix | 1 + modules/gui.nix | 61 ---------------------------------------- modules/periodic.nix | 66 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 61 deletions(-) create mode 100644 modules/periodic.nix diff --git a/configuration.nix b/configuration.nix index 325eb63..6e15967 100644 --- a/configuration.nix +++ b/configuration.nix @@ -139,6 +139,7 @@ ./modules/audio.nix ./modules/development.nix ./modules/printing.nix + ./modules/periodic.nix ./modules/hardware-configuration.nix ]; diff --git a/modules/gui.nix b/modules/gui.nix index 6469a83..fafd37a 100644 --- a/modules/gui.nix +++ b/modules/gui.nix @@ -104,65 +104,4 @@ in { # Integrate pass with the browser programs.browserpass.enable = true; - # Upgrade Doom Emacs daily - systemd.user.services.doom-upgrade = { - description = "Upgrade Doom Emacs"; - wantedBy = [ "default.target" ]; - path = [ pkgs.emacs pkgs.git ]; - serviceConfig = { - Type = "oneshot"; - ExecStart = - "/bin/sh /home/coolneng/.emacs.d/bin/doom -y upgrade ; /bin/sh /home/coolneng/.emacs.d/bin/doom -y update"; - }; - }; - - systemd.user.timers.doom-upgrade = { - description = "Daily upgrade of Doom Emacs"; - wantedBy = [ "default.target" ]; - timerConfig = { - OnCalendar = "20:00:00"; - Unit = "doom-upgrade.service"; - }; - }; - - # Clean up Doom Emacs monthly - systemd.user.services.doom-purge = { - description = "Purge Doom Emacs"; - wantedBy = [ "default.target" ]; - path = [ pkgs.emacs pkgs.git ]; - serviceConfig = { - Type = "oneshot"; - ExecStart = "/bin/sh /home/coolneng/.emacs.d/bin/doom purge"; - }; - }; - - systemd.user.timers.doom-purge = { - description = "Monthly purge of Doom Emacs"; - wantedBy = [ "default.target" ]; - timerConfig = { - OnCalendar = "13 22:00:00"; - Unit = "doom-purge.service"; - }; - }; - - # Upgrade Neovim plugins weekly - systemd.user.services.vim-plug-upgrade = { - description = "Upgrade Vim-Plug"; - wantedBy = [ "default.target" ]; - path = [ pkgs.git pkgs.neovim ]; - serviceConfig = { - Type = "oneshot"; - ExecStart = "${pkgs.neovim}/bin/nvim +PlugUpgrade +PlugUpdate +qa"; - }; - }; - - systemd.user.timers.vim-plug-upgrade = { - description = "Weekly upgrade of Vim-Plug"; - wantedBy = [ "default.target" ]; - timerConfig = { - OnCalendar = "Wed 18:00:00"; - Unit = "vim-plug-upgrade.service"; - }; - }; - } diff --git a/modules/periodic.nix b/modules/periodic.nix new file mode 100644 index 0000000..3c7c38e --- /dev/null +++ b/modules/periodic.nix @@ -0,0 +1,66 @@ +{ config, lib, pkgs, ... }: + +{ + + # Upgrade Doom Emacs daily + systemd.user.services.doom-upgrade = { + description = "Upgrade Doom Emacs"; + wantedBy = [ "default.target" ]; + path = [ pkgs.emacs pkgs.git ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = + "/bin/sh /home/coolneng/.emacs.d/bin/doom -y upgrade ; /bin/sh /home/coolneng/.emacs.d/bin/doom -y update"; + }; + }; + + systemd.user.timers.doom-upgrade = { + description = "Daily upgrade of Doom Emacs"; + wantedBy = [ "default.target" ]; + timerConfig = { + OnCalendar = "20:00:00"; + Unit = "doom-upgrade.service"; + }; + }; + + # Clean up Doom Emacs monthly + systemd.user.services.doom-purge = { + description = "Purge Doom Emacs"; + wantedBy = [ "default.target" ]; + path = [ pkgs.emacs pkgs.git ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "/bin/sh /home/coolneng/.emacs.d/bin/doom purge"; + }; + }; + + systemd.user.timers.doom-purge = { + description = "Monthly purge of Doom Emacs"; + wantedBy = [ "default.target" ]; + timerConfig = { + OnCalendar = "13 22:00:00"; + Unit = "doom-purge.service"; + }; + }; + + # Upgrade Neovim plugins weekly + systemd.user.services.vim-plug-upgrade = { + description = "Upgrade Vim-Plug"; + wantedBy = [ "default.target" ]; + path = [ pkgs.git pkgs.neovim ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.neovim}/bin/nvim +PlugUpgrade +PlugUpdate +qa"; + }; + }; + + systemd.user.timers.vim-plug-upgrade = { + description = "Weekly upgrade of Vim-Plug"; + wantedBy = [ "default.target" ]; + timerConfig = { + OnCalendar = "Wed 18:00:00"; + Unit = "vim-plug-upgrade.service"; + }; + }; + +}