From 38d581529181dd37a9b5d02d66214bac78348a4c Mon Sep 17 00:00:00 2001 From: coolneng Date: Thu, 28 May 2020 03:02:44 +0200 Subject: [PATCH] Switch to autofs and upgrade Doom Emacs daily --- modules/gui.nix | 60 +++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/modules/gui.nix b/modules/gui.nix index 08d9b8b..9625bad 100644 --- a/modules/gui.nix +++ b/modules/gui.nix @@ -44,7 +44,6 @@ export SDL_VIDEODRIVER=wayland export GTK_THEME=Adapta-Eta ''; - wrapperFeatures.gtk = true; }; # Backlight @@ -172,34 +171,37 @@ }; # Automount external storage - systemd.mounts = [ - # USB - { - what = "/dev/sdb1"; - where = "/usb"; - mountConfig = { TimeoutSec = "5"; }; - } - # SD card - { - what = "/dev/mmcblk0p1"; - where = "/sdcard"; - mountConfig = { TimeoutSec = "5"; }; - } - ]; + services.autofs = { + enable = true; + timeout = 5; + autoMaster = let + mapConf = pkgs.writeText "auto" '' + usb -fstype=auto :/dev/sdb1 + sdcard -fstype=auto :/dev/mmcblk0p1 + ''; + in '' + /media file:${mapConf} --timeout=5 + ''; + }; - systemd.automounts = [ - # USB - { - where = "/usb"; - automountConfig = { TimeoutIdleSec = "5"; }; - wantedBy = [ "default.target" ]; - } - # SD card - { - where = "/sdcard"; - automountConfig = { TimeoutIdleSec = "5"; }; - wantedBy = [ "default.target" ]; - } - ]; + # 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"; + }; + }; + + systemd.user.timers.doom-upgrade = { + description = "Daily upgrade of Doom Emacs"; + wantedBy = [ "default.target" ]; + timerConfig = { + OnCalendar = "20:00:00"; + Unit = "doom-upgrade.service"; + }; + }; }