summaryrefslogtreecommitdiff
path: root/home/config
diff options
context:
space:
mode:
Diffstat (limited to 'home/config')
-rw-r--r--home/config/emacs.nix32
1 files changed, 11 insertions, 21 deletions
diff --git a/home/config/emacs.nix b/home/config/emacs.nix
index abb45a4..f39086b 100644
--- a/home/config/emacs.nix
+++ b/home/config/emacs.nix
@@ -1,6 +1,11 @@
{ config, lib, pkgs, ... }:
-let cfg = config.programs.emacs;
+let
+ cfg = config.programs.emacs;
+ spacemacs-update-script = pkgs.writeShellScript "spacemacs-update" ''
+ ${pkgs.git}/bin/git pull
+ ${cfg.package}/bin/emacsclient --eval '(configuration-layer/update-packages)'
+ '';
in {
programs.emacs = {
enable = true;
@@ -13,36 +18,21 @@ in {
home.file.".spacemacs.d/init.el".source = ./dotfiles/spacemacs;
- systemd.user = lib.mkIf cfg.enable {
- services.update-spacemacs = {
+ systemd.user = lib.mkIf cfg.enable
+ (pkgs.personal.lib.serviceWithTimer "spacemacs-update" {
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" ];
+ ExecStart = "${spacemacs-update-script}";
};
-
Timer = {
- Unit = "update-spacemacs.service";
Persistent = true;
OnCalendar = "daily";
};
-
- Install.WantedBy = [ "default.target" ];
- };
- };
+ Install = { WantedBy = [ "default.target" ]; };
+ });
}