1

fix emacs module activation scripts

This commit is contained in:
2022-08-07 17:24:46 +02:00
parent b9ef34dbf9
commit 16a5617883

View File

@ -79,33 +79,35 @@ in {
# source = ../../config/doom; # source = ../../config/doom;
# }; # };
# If doom is enabled we want to clone the framework home.activation = (mkMerge [
# The activation script is being run when home-manager rebuilds (mkIf cfg.useDoom {
home.activation = mkIf cfg.useDoom {
# Because we write to the filesystem, this script has to be run after HomeManager's writeBoundary # If doom is enabled we want to clone the framework
installDoomEmacs = hm.dag.entryAfter [ "writeBoundary" ] '' # The activation script is being run when home-manager rebuilds
if [ ! -d "${config.home.homeDirectory}/.emacs.d" ]; then # Because we write to the filesystem, this script has to be run after HomeManager's writeBoundary
git clone --depth=1 --single-branch "https://github.com/doomemacs/doomemacs" "${config.home.homeDirectory}/.emacs.d" installDoomEmacs = hm.dag.entryAfter [ "writeBoundary" ] ''
fi if [ ! -d "${config.home.homeDirectory}/.emacs.d" ]; then
''; git clone --depth=1 --single-branch "https://github.com/doomemacs/doomemacs" "${config.home.homeDirectory}/.emacs.d"
fi
'';
# TODO: Put node after installDoomEmacs node # TODO: Put node after installDoomEmacs node
# With this approach we keep the config mutable as it is not copied and linked from store # With this approach we keep the config mutable as it is not copied and linked from store
linkDoomConfig = hm.dag.entryAfter [ "writeBoundary" ] '' linkDoomConfig = hm.dag.entryAfter [ "writeBoundary" ] ''
if [ ! -L "${config.home.homeDirectory}/.config/doom" ]; then if [ ! -L "${config.home.homeDirectory}/.config/doom" ]; then
ln -sf ${config.home.homeDirectory}/NixFlake/config/doom ${config.home.homeDirectory}/.config/doom ln -sf ${config.home.homeDirectory}/NixFlake/config/doom ${config.home.homeDirectory}/.config/doom
fi fi
''; '';
}; })
home.activation = mkIf cfg.autosync { (mkIf cfg.autosync {
# TODO: assert that doom is enabled and put node after linkDoomConfig node # TODO: assert that doom is enabled and put node after linkDoomConfig node
# No idea what happens on the first install, don't know if install or sync happens first # No idea what happens on the first install, don't know if install or sync happens first
syncDoomEmacs = hm.dag.entryAfter [ "writeBoundary" ] '' syncDoomEmacs = hm.dag.entryAfter [ "writeBoundary" ] ''
${home.homeDirectory}/.emacs.d/bin/doom sync ${config.home.homeDirectory}/.emacs.d/bin/doom sync
''; '';
}; })
]);
}; };
} }