# Advice needed installing doom-emacs

**URL:** https://discourse.nixos.org/t/advice-needed-installing-doom-emacs/8806
**Category:** Help
**Created:** [August 29, 2020, 10:20am UTC](https://discourse.nixos.org/t/advice-needed-installing-doom-emacs/8806 "2020-08-29T10:20:52Z")
**Posts on this page:** 1
**Showing post:** 8

<div class="post-metadata">

### Author: ![zeorin](https://discourse.nixos.org/user_avatar/discourse.nixos.org/zeorin/32/3832_2.png) [@zeorin](https://discourse.nixos.org/u/zeorin)
#### Post date: [March 21, 2021, 9:39pm UTC](https://discourse.nixos.org/t/advice-needed-installing-doom-emacs/8806/8 "2021-03-21T21:39:53Z")

</div>

Doom’s Emacs directory doesn’t strictly have to be writable. You can set the `DOOMLOCALDIR` to a writable location instead, that is the only part that has to be writable and it can be in an arbitrary location.

Also, once the Emacs directory has been updated via git, running `doom sync -u` is the same as `doom upgrade`.

I’ve got the following in my `home.nix` (irrelevant bits elided):

```auto
{ pkgs, config, lib, ... }:

{
  home = {
    sessionPath = ["${config.xdg.configHome}/emacs/bin"];
    sessionVariables = {
      DOOMDIR = "${config.xdg.configHome}/doom-config";
      DOOMLOCALDIR = "${config.xdg.configHome}/doom-local";
    };
  };

  xdg = {
    enable = true;
    configFile = {
      "doom-config/config.el".text = "…";
      "doom-config/init.el".text = "…";
      "doom-config/packages.el".text = "…";
      "emacs" = {
        source = builtins.fetchGit "https://github.com/hlissner/doom-emacs";
        onChange = "${pkgs.writeShellScript "doom-change" ''
          export DOOMDIR="${config.home.sessionVariables.DOOMDIR}"
          export DOOMLOCALDIR="${config.home.sessionVariables.DOOMLOCALDIR}"
          if [! -d "$DOOMLOCALDIR"]; then
            ${config.xdg.configHome}/emacs/bin/doom -y install
          else
            ${config.xdg.configHome}/emacs/bin/doom -y sync -u
          fi
        ''}";
      };
    };
  };

  home.packages = with pkgs; [
    # DOOM Emacs dependencies
    binutils
    (ripgrep.override { withPCRE2 = true; })
    gnutls
    fd
    imagemagick
    zstd
    nodePackages.javascript-typescript-langserver
    sqlite
    editorconfig-core-c
    emacs-all-the-icons-fonts
  ];
}

```

---

_[View the full topic](https://discourse.nixos.org/t/advice-needed-installing-doom-emacs/8806)._
