diff --git a/doom.nix b/doom.nix index b7112bf..cd63ebe 100644 --- a/doom.nix +++ b/doom.nix @@ -37,7 +37,7 @@ makeBinaryWrapper, }: let - inherit (lib) optionalAttrs optionalString pathExists; + inherit (lib) optionalAttrs optionalString; # Step 1: determine which Emacs packages to pull in. # @@ -225,19 +225,10 @@ let emacsWithPackages = doomEmacsPackages.emacsWithPackages (epkgs: (map (p: epkgs.${p}) (builtins.attrNames doomPackageSet))); # Step 4: build a final DOOMDIR with packages.el from step 1. - - finalInitFile = let - doomInitFile = "${doomDir}/init.el"; - in - if pathExists doomInitFile - then concatText "doom-init" [ ./pre-init.el doomInitFile ] - else ./pre-init.el; - + finalInitFile = concatText "doom-init" [ ./pre-init.el "${doomDir}/init.el" ]; finalDoomDir = runCommand "doom-dir" {} '' mkdir $out - if [[ -n "$(ls -A1 ${doomDir})" ]]; then - ln -s ${doomDir}/* $out/ - fi + ln -s ${doomDir}/* $out/ # yasnippet logs an error at startup if snippets/ does not exist. if ! [[ -e $out/snippets ]]; then mkdir $out/snippets diff --git a/example/init.el b/doomdirs/example/init.el similarity index 100% rename from example/init.el rename to doomdirs/example/init.el diff --git a/example/packages.el b/doomdirs/example/packages.el similarity index 100% rename from example/packages.el rename to doomdirs/example/packages.el diff --git a/doomdirs/minimal/init.el b/doomdirs/minimal/init.el new file mode 100644 index 0000000..54d163c --- /dev/null +++ b/doomdirs/minimal/init.el @@ -0,0 +1,2 @@ +;; Doom doesn't like a completely empty doom! block. +(doom! :config default) diff --git a/flake.nix b/flake.nix index 528b7c9..b2d085b 100644 --- a/flake.nix +++ b/flake.nix @@ -29,9 +29,9 @@ # Current Doom + NixOS 23.11 requires emacs-overlay: Doom pins # emacs-fish-completion, which moved from gitlab to github recently # enough stable nixpkgs pulls it from the wrong source. - doom-minimal = pkgsWithEmacsOverlay.callPackage ./doom.nix (common // { doomDir = pkgs.emptyDirectory; }); - doom-full = pkgsWithEmacsOverlay.callPackage ./doom.nix (common // { full = true; doomDir = pkgs.emptyDirectory; }); - doom-example = pkgsWithEmacsOverlay.callPackage ./doom.nix (common // { doomDir = ./example; }); + doom-minimal = pkgsWithEmacsOverlay.callPackage ./doom.nix (common // { doomDir = ./doomdirs/minimal; }); + doom-full = pkgsWithEmacsOverlay.callPackage ./doom.nix (common // { full = true; doomDir = ./doomdirs/minimal; }); + doom-example = pkgsWithEmacsOverlay.callPackage ./doom.nix (common // { doomDir = ./doomdirs/example; }); }); overlays.default = final: prev: let