summaryrefslogtreecommitdiff
path: root/home
diff options
context:
space:
mode:
authorQuentin Aristote <quentin@aristote.fr>2022-09-17 13:13:13 +0200
committerQuentin Aristote <quentin@aristote.fr>2022-09-17 13:13:13 +0200
commitd5887d64d96183c802bf925bc0e279901ec278f4 (patch)
treededdf9d68a15b253ed62194996b78ad36ab3065b /home
parent15e73a21f2b8a61a0bb9ad64e81aa559f8d12fbe (diff)
home: emacs: add service to autoupdate spacemacs
Diffstat (limited to 'home')
-rw-r--r--home/config/emacs.nix41
1 files changed, 37 insertions, 4 deletions
diff --git a/home/config/emacs.nix b/home/config/emacs.nix
index c12f917..4b70090 100644
--- a/home/config/emacs.nix
+++ b/home/config/emacs.nix
@@ -1,6 +1,7 @@
-{ pkgs, ... }:
+{ config, lib, pkgs, ... }:
-{
+let cfg = config.programs.emacs;
+in {
programs.emacs = {
enable = true;
# package = pkgs.emacs.overrideAttrs (oldAttrs: rec { nativeComp = true; });
@@ -11,6 +12,38 @@
};
home.file.".spacemacs.d/init.el".source = ./dotfiles/spacemacs;
- home.file.".emacs.d/private/layers/why3/local/why3.backup".source =
- "${pkgs.why3}/share/emacs/site-lisp";
+
+ systemd.user = lib.mkIf cfg.enable {
+ services.update-spacemacs = {
+ Unit = {
+ Description = "Update Spacemacs by pulling the develop branch";
+ After = [ "network-online.target" ];
+ X-RestartIfChanged = true;
+ };
+
+ Service = {
+ Type = "oneshot";
+ WorkingDirectory = "${config.home.homeDirectory}/.emacs.d/";
+ ExecStart =
+ "${pkgs.git}/bin/git pull ; ${cfg.package}/bin/emacsclient --eval '(configuration-layer/update-packages)'";
+ };
+
+ Install.WantedBy = [ "default.target" ];
+ };
+ timers.update-spacemacs = {
+ Unit = {
+ Description = "Run Spacemacs update periodically";
+ After = [ "network-online.target" ];
+ X-RestartIfChanged = true;
+ };
+
+ Timer = {
+ Unit = "update-spacemacs.service";
+ Persistent = true;
+ OnCalendar = "daily";
+ };
+
+ Install.WantedBy = [ "default.target" ];
+ };
+ };
}