Add extraBinPackages for adding to $PATH
and use it to make sure Doom's essential prerequisites are available.
This commit is contained in:
parent
9b1356765b
commit
c61cd622b7
4 changed files with 30 additions and 1 deletions
|
|
@ -160,6 +160,9 @@ support use without flakes.
|
||||||
- `doomSource`: Doom source tree. Defaults to a flake input: overriding that
|
- `doomSource`: Doom source tree. Defaults to a flake input: overriding that
|
||||||
input is probably easier than passing this.
|
input is probably easier than passing this.
|
||||||
|
|
||||||
|
- `extraBinPackages`: packages to add to `$PATH`. Defaults to Git, ripgrep and
|
||||||
|
fd.
|
||||||
|
|
||||||
- `extraPackages`: Specify extra Emacs packages from nixpkgs to be available to
|
- `extraPackages`: Specify extra Emacs packages from nixpkgs to be available to
|
||||||
Doom Emacs. Defaults to this function `epkgs: [ ]` (no extra packages).
|
Doom Emacs. Defaults to this function `epkgs: [ ]` (no extra packages).
|
||||||
For example to include Emacs package `treesit-grammars.with-all-grammars`:
|
For example to include Emacs package `treesit-grammars.with-all-grammars`:
|
||||||
|
|
|
||||||
|
|
@ -22,15 +22,25 @@ else
|
||||||
--set DOOMPROFILE "$profileName"
|
--set DOOMPROFILE "$profileName"
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
common=()
|
||||||
|
if [[ -n "$binPath" ]]; then
|
||||||
|
common+=(
|
||||||
|
--suffix PATH : "$binPath"
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
makeWrapper $emacsWithPackages/bin/emacs $out/bin/doom-emacs \
|
makeWrapper $emacsWithPackages/bin/emacs $out/bin/doom-emacs \
|
||||||
"${profileArgs[@]}" \
|
"${profileArgs[@]}" \
|
||||||
|
"${common[@]}" \
|
||||||
--set DOOMDIR $doomProfile/doomdir \
|
--set DOOMDIR $doomProfile/doomdir \
|
||||||
--set-default DOOMLOCALDIR "$doomLocalDir" \
|
--set-default DOOMLOCALDIR "$doomLocalDir" \
|
||||||
--add-flags "--init-directory=$doomSource"
|
--add-flags "--init-directory=$doomSource"
|
||||||
makeWrapper $doomSource/bin/doomscript $out/bin/doomscript \
|
makeWrapper $doomSource/bin/doomscript $out/bin/doomscript \
|
||||||
|
"${common[@]}" \
|
||||||
--set EMACS $emacsWithPackages/bin/emacs \
|
--set EMACS $emacsWithPackages/bin/emacs \
|
||||||
--set-default DOOMLOCALDIR "$doomLocalDir"
|
--set-default DOOMLOCALDIR "$doomLocalDir"
|
||||||
makeWrapper $doomSource/bin/doom $out/bin/doom \
|
makeWrapper $doomSource/bin/doom $out/bin/doom \
|
||||||
|
"${common[@]}" \
|
||||||
--set EMACS $emacsWithPackages/bin/emacs \
|
--set EMACS $emacsWithPackages/bin/emacs \
|
||||||
"${profileArgs[@]}" \
|
"${profileArgs[@]}" \
|
||||||
--set DOOMDIR $doomProfile/doomdir \
|
--set DOOMDIR $doomProfile/doomdir \
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,14 @@
|
||||||
experimentalFetchTree ? false,
|
experimentalFetchTree ? false,
|
||||||
/* Extra emacs packages from nixpkgs */
|
/* Extra emacs packages from nixpkgs */
|
||||||
extraPackages ? epkgs: [ ],
|
extraPackages ? epkgs: [ ],
|
||||||
|
/* Extra packages to add to $PATH */
|
||||||
|
extraBinPackages ? [ git fd ripgrep ],
|
||||||
|
|
||||||
callPackage,
|
callPackage,
|
||||||
callPackages,
|
callPackages,
|
||||||
|
fd,
|
||||||
git,
|
git,
|
||||||
|
ripgrep,
|
||||||
emacsPackagesFor,
|
emacsPackagesFor,
|
||||||
lib,
|
lib,
|
||||||
runCommandLocal,
|
runCommandLocal,
|
||||||
|
|
@ -325,6 +329,7 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# Step 6: write wrappers to start the whole thing.
|
# Step 6: write wrappers to start the whole thing.
|
||||||
|
binPath = lib.makeBinPath extraBinPackages;
|
||||||
|
|
||||||
# makeBinaryWrapper pulls in a compiler, so don't force this one local.
|
# makeBinaryWrapper pulls in a compiler, so don't force this one local.
|
||||||
doomEmacs = stdenv.mkDerivation {
|
doomEmacs = stdenv.mkDerivation {
|
||||||
|
|
@ -332,7 +337,7 @@ let
|
||||||
buildCommandPath = ./build-helpers/build-doom-emacs.sh;
|
buildCommandPath = ./build-helpers/build-doom-emacs.sh;
|
||||||
|
|
||||||
# emacsWithPackages also accessed externally (for pushing to Cachix).
|
# emacsWithPackages also accessed externally (for pushing to Cachix).
|
||||||
inherit doomProfile doomLocalDir doomSource emacsWithPackages profileName;
|
inherit binPath doomProfile doomLocalDir doomSource emacsWithPackages profileName;
|
||||||
|
|
||||||
nativeBuildInputs = [ makeBinaryWrapper ];
|
nativeBuildInputs = [ makeBinaryWrapper ];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,17 @@ in {
|
||||||
Doom cannot specify that package using the '(package! ...)' syntax.
|
Doom cannot specify that package using the '(package! ...)' syntax.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
extraBinPackages = mkOption {
|
||||||
|
default = [
|
||||||
|
config.programs.ripgrep.package
|
||||||
|
config.programs.git.package
|
||||||
|
config.programs.fd.package
|
||||||
|
];
|
||||||
|
type = types.listOf types.package;
|
||||||
|
defaultText = literalExpression
|
||||||
|
"[ programs.ripgrep.package programs.git.package programs.fd.package ]";
|
||||||
|
description = "Extra packages to add to Doom's $PATH.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue