From 14a6477aed02aec31d2ad1a71bb12061d6a25b3d Mon Sep 17 00:00:00 2001 From: ChUrl Date: Sun, 3 Jul 2022 19:09:14 +0200 Subject: [PATCH] Link doom config mutably --- home/modules/emacs.nix | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/home/modules/emacs.nix b/home/modules/emacs.nix index 8bb42c9c..6fe12952 100644 --- a/home/modules/emacs.nix +++ b/home/modules/emacs.nix @@ -71,20 +71,26 @@ in { ]; # We tell HomeManager where the config files belong - home.file.".config/doom" = { - # With onChange you even could rebuild doom emacs when rebuilding HomeManager but I don't want this to become too slow - recursive = true; # is a directory - source = ../../config/doom; - }; + # home.file.".config/doom" = { + # # With onChange you even could rebuild doom emacs when rebuilding HomeManager but I don't want this to become too slow + # recursive = true; # is a directory + # source = ../../config/doom; + # }; # If doom is enabled we want to clone the framework # The activation script is being run when home-manager rebuilds home.activation = mkIf cfg.useDoom { - # Because we write to the filesystem, this script has to be run after HomeManager's writeBoundary - installDoomEmacs = hm.dag.entryAfter ["writeBoundary"] '' + installDoomEmacs = hm.dag.entryAfter [ "writeBoundary" ] '' if [ ! -d "${config.home.homeDirectory}/.emacs.d" ]; then - git clone --depth=1 --single-branch "https://github.com/doomemacs/doomemacs" "${config.home.homeDirectory}/.emacs.d" + git clone --depth=1 --single-branch "https://github.com/doomemacs/doomemacs" "${config.home.homeDirectory}/.emacs.d" + fi + ''; + + # With this approach we keep the config mutable as it is not copied and linked from store + linkDoomConfig = hm.dag.entryAfter [ "writeBoundary" ] '' + if [ ! -L "${config.home.homeDirectory}/.config/doom" ]; then + ln -sf ${config.home.homeDirectory}/NixFlake/config/doom ${config.home.homeDirectory}/.config/doom fi ''; };