Add emacsWithDoom to overlay

This commit is contained in:
Marien Zwart 2024-04-27 16:14:28 +10:00
parent 1399755050
commit d9aad25bec
No known key found for this signature in database
2 changed files with 29 additions and 11 deletions

View file

@ -23,8 +23,6 @@
full ? false,
/* Name of doom profile to use. */
profileName ? "nix",
/* Name to give to the main binary (to facilitate parallel installs with Emacs). */
binaryName ? "emacs",
callPackages,
git,
@ -277,11 +275,11 @@ let
'';
# Step 6: write wrappers to start the whole thing.
pkg = runCommand "doom" {
doomEmacs = runCommand "doom-emacs" {
nativeBuildInputs = [ makeBinaryWrapper ];
}
''
makeWrapper ${emacsWithPackages}/bin/emacs $out/bin/${binaryName} \
makeWrapper ${emacsWithPackages}/bin/emacs $out/bin/doom-emacs \
--set DOOMPROFILELOADFILE ${doomProfile}/loader/init.el \
--set DOOMPROFILE ${profileName} \
--set-default DOOMLOCALDIR "${doomLocalDir}" \
@ -311,5 +309,23 @@ let
# It is probably possible to hack around that, but let's see if we can make
# the default profile work first: `doom doctor` may have additional problems too
# hard to solve.
emacsWithDoom = runCommand (lib.appendToName "with-doom" emacs).name {
inherit (emacs) meta;
} ''
mkdir -p $out/bin
ln -s ${emacs}/bin/* $out/bin/
rm $out/bin/emacs-*
ln -sf ${doomEmacs}/bin/doom-emacs $out/bin/emacs
mkdir -p $out/share
# Don't link everything: the systemd units would still refer to normal Emacs.
# This links the same stuff emacsWithPackages does.
for dir in applications icons info man; do
ln -s ${emacs}/share/$dir $out/share/$dir
done
'';
in
pkg
{
inherit doomEmacs emacsWithDoom;
}

View file

@ -29,17 +29,19 @@
# 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 = ./doomdirs/minimal; });
doom-full = pkgsWithEmacsOverlay.callPackage ./doom.nix (common // { full = true; doomDir = ./doomdirs/minimal; });
doom-example = pkgsWithEmacsOverlay.callPackage ./doom.nix (common // { doomDir = ./doomdirs/example; });
doom-minimal = (pkgsWithEmacsOverlay.callPackages ./doom.nix (common // { doomDir = ./doomdirs/minimal; })).doomEmacs;
doom-full = (pkgsWithEmacsOverlay.callPackages ./doom.nix (common // { full = true; doomDir = ./doomdirs/minimal; })).doomEmacs;
doom-example = (pkgsWithEmacsOverlay.callPackages ./doom.nix (common // { doomDir = ./doomdirs/example; })).doomEmacs;
});
overlays.default = final: prev:
let
pkgs = final.extend emacs-overlay.overlays.package;
in {
doomEmacs = args: pkgs.callPackage ./doom.nix ({
callPackages = args: (pkgs.callPackages ./doom.nix ({
doomSource = doomemacs;
} // args);
} // args));
in {
doomEmacs = args: (callPackages args).doomEmacs;
emacsWithDoom = args: (callPackages args).emacsWithDoom;
};
};
}