Doomemacs derivation

I just installed NixOs due to some Windows errors and I’m trying to install doomemacs as my editor through home-manager. So I first made the following derivation:

let
  nixpkgs = import <nixpkgs> {};
  installDoom  = ''
      $DOOM = $out
      if [ ! -d $DOOM ]; then
        mkdir -p $DOOM
      fi
      cp -rv $src/* $DOOM
      $DOOM/bin/doom install
   '';
  doom-drv = nixpkgs.stdenv.mkDerivation {
  name = "doom-emacs-drv";
  unpackPhase = "true";
  buildInputs = [ 
    nixpkgs.emacs
    nixpkgs.fd
    nixpkgs.git
    nixpkgs.findutils
    nixpkgs.ripgrep
  ];
  src = nixpkgs.fetchFromGitHub {
    owner = "doomemacs";
    repo  = "doomemacs";
    rev   = "74999956438ae0461f89569b7abb00205635ce93";
    hash  = "sha256-w04/zo6OW8GP1ooPU2aT1wlwZFtf/hdojKd4/9GtXoI=";
  };
  buildPhase = installDoom;
  };
in doom-drv

Nevertheless, when I try to build it in the nix-repl I get the following error:

@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
Running phase: configurePhase
no configure script, doing nothing
@nix { "action": "setPhase", "phase": "buildPhase" }
Running phase: buildPhase
/nix/store/61h5fgmxl3biljwbhxvr55qkxsp44yla-stdenv-linux/setup: line 1579: =: command not found

This is my first derivation, and I’m kind of at a loss. Anybody got an idea where I screwed up?

You probably meant something like DOOM=$out.

Oh, you are right!

There is also the issue that doom install pulls packages from the internet. So I’ll probably will have to find a way to pull those from within nix… Sadly right now i’m a bit tight on time and green to do that project.

I ended up installing it the non Nix way. A bit discouraging for a learner, but everything else has been working neatly so far.