hlissner / dotfiles

And I say hey, what's going on?
https://youtu.be/ZZ5LpwO-An4
MIT License
1.62k stars 98 forks source link

How are you managing doom-emacs? #20

Closed tim-hilt closed 2 years ago

tim-hilt commented 3 years ago

I found a commented out section in modules/editors/emacs.nix, which seems like pulling in doom, if the doom-flag is enabled.

However, if that is the way you typically install it, why is it commented out? Are you managing doom outside of the NixOS-config or something?

Not really an issue, but I think that it's an interesting question that I haven't really found an answer for yet.

hlissner commented 2 years ago

Hi! Sorry for the (tremendously) late response. I manage Doom by hand. The commented out block is more than fine for Doom users who won't touch ~/.emacs.d much, but in my hands the directory sees a lot of movement, making it more trouble than its worth to nixify Doom (or even trying to pull it every time I rebuild).

You'll find a popular effort to nixify Doom on https://github.com/vlaci/nix-doom-emacs, but I generally recommend against it. Emacs is a very stateful program with lots of moving parts, with or without Doom. /nix's read-only-ness will cause issues without a lot of hackery that may cause their own problems. Once Doom is a little more mature I'll start thinking about making it more nixos/guix friendly, but we're at least a year away from that.

Anyhow, hope that helped!

vandr0iy commented 2 years ago

To follow on your answer up here: how does that part even work? If I attempt to uncomment it, this is what I get:

# nixos-rebuild switch --show-trace
error: The option `init' does not exist. Definition values:
       - In `/nix/store/ir0fjbffvd61nbg46j49w889dhav3nrx-source':
           {
             _type = "if";
             condition = true;
             content = {
               doomEmacs = {
           ...
hlissner commented 2 years ago

how does that part even work?

It doesn't anymore, I'm afraid. I found my home-baked init option redundant with system.userActivationScripts, so I removed it. Here's how you'd adapt that commented out block to it:

system.userActivationScripts = mkIf cfg.doom.enable {
  installDoomEmacs = ''
    if [ ! -d "$XDG_CONFIG_HOME/emacs" ]; then
       git clone --depth=1 --single-branch https://github.com/hlissner/doom-emacs "$XDG_CONFIG_HOME/emacs"
       git clone https://github.com/hlissner/doom-emacs-private "$XDG_CONFIG_HOME/doom"
    fi
  '';
};

EDIT: Fixed the condition in snippet

vandr0iy commented 2 years ago

Wow, that was fast :exploding_head: Anyways, it works, thank you!

P.S. You probably must've meant if [ ! -d $HOME/.config/emacs ]; ?

hlissner commented 2 years ago

P.S. You probably must've meant if [ ! -d $HOME/.config/emacs ]; ?

Whoops! Yes, you're correct.

Glad I could help!