2024-04-28 12:26:05 +10:00
|
|
|
|
# Copyright 2024 Google LLC
|
|
|
|
|
|
#
|
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
|
|
#
|
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
#
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
2024-03-04 01:29:47 +11:00
|
|
|
|
{
|
2024-03-30 23:59:56 +11:00
|
|
|
|
/* DOOMDIR / Doom private directory / module. */
|
2024-04-07 14:12:53 +10:00
|
|
|
|
doomDir,
|
2024-04-08 21:43:54 +10:00
|
|
|
|
/* Default DOOMLOCALDIR.
|
|
|
|
|
|
*
|
|
|
|
|
|
* Required, because the default is relative to Doom's source tree,
|
|
|
|
|
|
* which is read-only.
|
|
|
|
|
|
*
|
|
|
|
|
|
* Expanded using expand-file-name (an initial ~ is supported,
|
|
|
|
|
|
* shell variable expansion is not).
|
|
|
|
|
|
*
|
|
|
|
|
|
* DOOMLOCALDIR in the environment Emacs is started with overrides this.
|
|
|
|
|
|
*
|
|
|
|
|
|
* Suggested value: ~/.local/share/doom
|
|
|
|
|
|
*/
|
|
|
|
|
|
doomLocalDir,
|
2024-03-04 01:29:47 +11:00
|
|
|
|
/* Doom source tree. */
|
|
|
|
|
|
doomSource,
|
|
|
|
|
|
/* Emacs package to build against. */
|
|
|
|
|
|
emacs,
|
|
|
|
|
|
/* Whether to enable all default dependencies. Primarily useful for CI /
|
|
|
|
|
|
testing. */
|
|
|
|
|
|
full ? false,
|
2024-03-29 22:54:58 +11:00
|
|
|
|
/* Name of doom profile to use. */
|
|
|
|
|
|
profileName ? "nix",
|
2024-04-28 16:39:50 +10:00
|
|
|
|
/* Disable profile early in startup, so "normal" cache/state dirs are used. */
|
|
|
|
|
|
noProfileHack ? false,
|
2024-03-04 01:29:47 +11:00
|
|
|
|
|
2024-03-04 15:18:20 +11:00
|
|
|
|
callPackages,
|
2024-03-26 22:28:43 +11:00
|
|
|
|
git,
|
2024-03-04 01:29:47 +11:00
|
|
|
|
emacsPackagesFor,
|
|
|
|
|
|
lib,
|
|
|
|
|
|
runCommand,
|
|
|
|
|
|
runtimeShell,
|
2024-03-04 19:19:51 +11:00
|
|
|
|
writeText,
|
2024-03-29 22:54:58 +11:00
|
|
|
|
makeBinaryWrapper,
|
2024-03-04 01:29:47 +11:00
|
|
|
|
}:
|
|
|
|
|
|
let
|
2024-04-27 14:53:17 +10:00
|
|
|
|
inherit (lib) optionalAttrs optionalString;
|
2024-04-27 21:28:39 +10:00
|
|
|
|
inherit (import ./fetch-overrides.nix) extraPins extraUrls;
|
2024-03-30 23:59:56 +11:00
|
|
|
|
|
2024-03-04 01:29:47 +11:00
|
|
|
|
# Step 1: determine which Emacs packages to pull in.
|
|
|
|
|
|
#
|
2024-04-25 16:09:42 +10:00
|
|
|
|
# Inputs: Doom, original DOOMDIR (only init.el and packages.el are used).
|
2024-03-04 01:29:47 +11:00
|
|
|
|
# Outputs:
|
|
|
|
|
|
# - Packages Doom normally loads using Straight (as json)
|
|
|
|
|
|
# - modified packages.el that claims all packages are system-installed
|
|
|
|
|
|
#
|
|
|
|
|
|
# Uses Doom's CLI framework, which does not require anything else is installed
|
|
|
|
|
|
# (not even straight).
|
|
|
|
|
|
|
|
|
|
|
|
# XXX this may need to be runCommandLocal just in case conditionals an init.el
|
|
|
|
|
|
# / packages.el evaluate differently on build systems.
|
|
|
|
|
|
doomIntermediates = runCommand "doom-intermediates"
|
|
|
|
|
|
{
|
|
|
|
|
|
env = {
|
|
|
|
|
|
EMACS = lib.getExe emacs;
|
2024-04-25 16:09:42 +10:00
|
|
|
|
DOOMDIR = "${doomDir}";
|
2024-03-31 16:47:48 +11:00
|
|
|
|
# Enable this to troubleshoot failures at this step.
|
|
|
|
|
|
#DEBUG = "1";
|
2024-03-04 01:29:47 +11:00
|
|
|
|
};
|
2024-03-31 16:47:48 +11:00
|
|
|
|
# We set DOOMLOCALDIR somewhere harmless below to stop Doom from trying to
|
|
|
|
|
|
# create it somewhere read-only.
|
2024-03-04 01:29:47 +11:00
|
|
|
|
} ''
|
|
|
|
|
|
mkdir $out
|
|
|
|
|
|
export DOOMLOCALDIR=$(mktemp -d)
|
2024-04-25 16:09:42 +10:00
|
|
|
|
${runtimeShell} ${doomSource}/bin/doomscript ${./build-helpers/dump} \
|
2024-03-04 01:29:47 +11:00
|
|
|
|
${optionalString full "--full"} -o $out
|
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
|
|
doomPackageSet = lib.importJSON "${doomIntermediates}/packages.json";
|
|
|
|
|
|
|
2024-03-26 22:28:43 +11:00
|
|
|
|
# Step 2: override Emacs packages to respect Doom's pins.
|
2024-03-04 01:29:47 +11:00
|
|
|
|
doomEmacsPackages = (emacsPackagesFor emacs).overrideScope (
|
|
|
|
|
|
eself: esuper:
|
|
|
|
|
|
let
|
2024-03-04 15:18:20 +11:00
|
|
|
|
customPackages = callPackages ./elisp-packages.nix { inherit emacs esuper eself; };
|
2024-03-24 15:41:33 +11:00
|
|
|
|
# We want to override `version` along with `src` to avoid spurious
|
|
|
|
|
|
# rebuilds on version bumps in emacs-overlay of packages Doom has
|
|
|
|
|
|
# pinned.
|
|
|
|
|
|
#
|
|
|
|
|
|
# The elisp manual says we need a version `version-to-list` can parse,
|
|
|
|
|
|
# which means it must start with a number and cannot contain the actual
|
|
|
|
|
|
# commit ID. We start with a large integer in case package.el starts
|
|
|
|
|
|
# version-checking dependencies (it currently does not but a comment in
|
|
|
|
|
|
# the code says it should). Additionally, `(package-version-join
|
|
|
|
|
|
# (version-to-list v))` must roundtrip to avoid elpa2nix failing with
|
|
|
|
|
|
# "Package does not untar cleanly".
|
|
|
|
|
|
snapshotVersion = "9999snapshot";
|
|
|
|
|
|
|
2024-03-04 01:29:47 +11:00
|
|
|
|
makePackage = name: p:
|
|
|
|
|
|
assert lib.asserts.assertEachOneOf
|
|
|
|
|
|
"keys for ${name}"
|
|
|
|
|
|
(lib.attrNames p)
|
|
|
|
|
|
[ "modules" "recipe" "pin" "type" ];
|
|
|
|
|
|
assert (p ? type) -> lib.asserts.assertOneOf
|
|
|
|
|
|
"type of ${name}"
|
|
|
|
|
|
p.type
|
|
|
|
|
|
[ "core" ];
|
|
|
|
|
|
let
|
|
|
|
|
|
origEPkg = esuper.${name} or null;
|
2024-04-05 23:34:52 +11:00
|
|
|
|
pin = p.pin or extraPins.${name} or null;
|
2024-03-04 01:29:47 +11:00
|
|
|
|
# We have to specialcase ELPA packages pinned by Doom: Straight mirrors /
|
|
|
|
|
|
# repackages them. Doom's pins assume that mirror is used (so we have to
|
|
|
|
|
|
# use it), and replacing the source in nixpkgs's derivation will not work
|
|
|
|
|
|
# (it assumes it gets a tarball as input).
|
|
|
|
|
|
|
|
|
|
|
|
# TODO: check notmuch works correctly without notmuch-version.el
|
|
|
|
|
|
|
|
|
|
|
|
isElpa = origEPkg != null && (origEPkg == esuper.elpaPackages.${name} or null || origEPkg == esuper.nongnuPackages.${name} or null);
|
|
|
|
|
|
epkg =
|
|
|
|
|
|
customPackages.${name}
|
2024-03-24 15:36:08 +11:00
|
|
|
|
or (if origEPkg == null || (p ? pin && isElpa)
|
|
|
|
|
|
then
|
2024-03-04 01:29:47 +11:00
|
|
|
|
assert lib.assertMsg
|
2024-04-05 23:34:52 +11:00
|
|
|
|
(isElpa || (p ? recipe && pin != null) || extraUrls ? ${name})
|
2024-03-04 01:29:47 +11:00
|
|
|
|
"${name}: not in epkgs, not elpa, no recipe or not pinned";
|
|
|
|
|
|
# Assume we can safely ignore (pre-)build unless we're actually
|
|
|
|
|
|
# building our own package.
|
|
|
|
|
|
assert lib.assertMsg (!(p ? recipe.pre-build)) "${name}: pre-build not supported";
|
|
|
|
|
|
assert lib.assertMsg (!(p ? recipe.build)) "${name}: build not supported";
|
2024-03-24 15:38:29 +11:00
|
|
|
|
# TODO: lift "pin" requirement, if that turns out to be
|
|
|
|
|
|
# necessary or at least desirable. Requires figuring out why
|
|
|
|
|
|
# melpa2nix requires `commit`. Not a priority because if it's
|
|
|
|
|
|
# not in epkgs we'd need a recipe passed in, and it's uncommon
|
|
|
|
|
|
# for Doom to pass in a recipe without pinning.
|
|
|
|
|
|
#
|
|
|
|
|
|
# Doom does currently have unpinned packages with an explicit
|
|
|
|
|
|
# recipe, but they're in epkgs (popon and flymake-popon) so it
|
|
|
|
|
|
# should be ok. Users might do this to pull in a custom package
|
|
|
|
|
|
# they don't care about pinning, though: we may want to support
|
|
|
|
|
|
# that.
|
2024-04-05 23:34:52 +11:00
|
|
|
|
assert lib.assertMsg (pin != null)
|
2024-03-24 15:38:29 +11:00
|
|
|
|
"${name}: not in epkgs and not pinned. This is not yet supported.";
|
2024-03-04 19:19:51 +11:00
|
|
|
|
# epkgs.*Build helpers take an attrset, they do not support
|
2024-03-04 01:29:47 +11:00
|
|
|
|
# mkDerivation's fixed-point evaluation (`finalAttrs`).
|
2024-03-04 19:19:51 +11:00
|
|
|
|
# If they did, the buildInputs stuff should use finalAttrs.src.
|
|
|
|
|
|
|
|
|
|
|
|
# This uses melpaBuild instead of trivialBuild to end up with
|
|
|
|
|
|
# something package.el understands as satisfying dependencies.
|
|
|
|
|
|
# This is necessary if we're replacing a pinned ELPA dependency
|
|
|
|
|
|
# of an unpinned ELPA package.
|
2024-03-05 22:23:40 +11:00
|
|
|
|
esuper.melpaBuild {
|
2024-03-04 01:29:47 +11:00
|
|
|
|
pname = name;
|
2024-03-24 15:41:33 +11:00
|
|
|
|
# melpaBuild requires we set `version` and `commit` here
|
|
|
|
|
|
# (leaving `version` unset until overrideAttrs below does not
|
|
|
|
|
|
# work).
|
|
|
|
|
|
version = snapshotVersion;
|
2024-04-05 23:34:52 +11:00
|
|
|
|
commit = pin;
|
2024-03-04 01:29:47 +11:00
|
|
|
|
meta = {
|
|
|
|
|
|
description = "trivial build for doom-emacs";
|
|
|
|
|
|
};
|
2024-03-04 19:19:51 +11:00
|
|
|
|
# Just enough to make melpa2nix work.
|
2024-04-06 22:25:48 +11:00
|
|
|
|
recipe = writeText "${name}-generated-recipe" ''
|
2024-03-05 22:23:40 +11:00
|
|
|
|
(${name} :fetcher github :repo "marienz/made-up"
|
2024-04-06 22:23:58 +11:00
|
|
|
|
${optionalString (p ? recipe.files) ":files ${p.recipe.files}"})'';
|
2024-04-08 21:18:10 +10:00
|
|
|
|
packageRequires = (map (name: eself.${name}) reqlist);
|
2024-03-24 15:36:08 +11:00
|
|
|
|
}
|
|
|
|
|
|
else origEPkg);
|
2024-03-04 01:29:47 +11:00
|
|
|
|
url =
|
|
|
|
|
|
if (p.recipe.host or "") == "github" && p ? recipe.repo
|
|
|
|
|
|
then "https://github.com/${p.recipe.repo}"
|
|
|
|
|
|
else epkg.src.gitRepoUrl
|
2024-04-07 00:15:10 +11:00
|
|
|
|
or extraUrls.${name}
|
2024-03-04 01:29:47 +11:00
|
|
|
|
or (if isElpa then "https://github.com/emacs-straight/${name}"
|
2024-04-07 00:15:10 +11:00
|
|
|
|
else (throw "${name}: cannot derive url from recipe ${p.recipe or "<missing>"}"));
|
2024-03-04 01:29:47 +11:00
|
|
|
|
# Use builtins.fetchGit instead of nixpkgs's fetchFromGitHub because
|
|
|
|
|
|
# fetchGit allows fetching a specific git commit without a hash.
|
2024-03-04 16:05:22 +11:00
|
|
|
|
# TODO: port to fetchTree once (mostly) stable
|
|
|
|
|
|
# (in particular the github fetcher may be noticably more efficient)
|
2024-03-04 01:29:47 +11:00
|
|
|
|
src = builtins.fetchGit (
|
|
|
|
|
|
{
|
|
|
|
|
|
inherit url;
|
2024-04-05 23:34:52 +11:00
|
|
|
|
rev = pin;
|
2024-03-04 01:29:47 +11:00
|
|
|
|
submodules = !(p.recipe.nonrecursive or false);
|
|
|
|
|
|
# TODO: might need to pull ref from derivation.src if we're not pulling it from p.recipe?
|
|
|
|
|
|
# Note Doom does have packages with pin + branch (or nonrecursive) set,
|
|
|
|
|
|
# expecting to inherit the rest of the recipe from Straight.
|
|
|
|
|
|
} // optionalAttrs (p ? recipe.branch) { ref = p.recipe.branch; }
|
|
|
|
|
|
// optionalAttrs (p ? recipe.depth) { shallow = p.recipe.depth == 1; }
|
|
|
|
|
|
);
|
|
|
|
|
|
reqfile = runCommand "${name}-deps" { } ''
|
2024-04-27 14:21:34 +10:00
|
|
|
|
${lib.getExe emacs} -Q --batch --script \
|
|
|
|
|
|
${./build-helpers/print-deps.el} ${src} > $out
|
2024-03-04 01:29:47 +11:00
|
|
|
|
'';
|
|
|
|
|
|
reqjson = lib.importJSON reqfile;
|
|
|
|
|
|
# json-encode encodes the empty list as null (nil), not [].
|
|
|
|
|
|
reqlist = if reqjson == null then [ ] else reqjson;
|
|
|
|
|
|
in
|
2024-04-05 23:34:52 +11:00
|
|
|
|
if pin != null
|
2024-03-24 15:41:33 +11:00
|
|
|
|
then epkg.overrideAttrs {
|
|
|
|
|
|
inherit src;
|
|
|
|
|
|
version = snapshotVersion;
|
|
|
|
|
|
}
|
2024-03-04 01:29:47 +11:00
|
|
|
|
else epkg;
|
|
|
|
|
|
in
|
|
|
|
|
|
lib.mapAttrs makePackage doomPackageSet
|
|
|
|
|
|
);
|
|
|
|
|
|
|
2024-03-26 22:28:43 +11:00
|
|
|
|
# Step 3: Build an emacsWithPackages, pulling all packages from step 1 from
|
|
|
|
|
|
# the set from step 2.
|
2024-03-04 01:29:47 +11:00
|
|
|
|
emacsWithPackages = doomEmacsPackages.emacsWithPackages (epkgs: (map (p: epkgs.${p}) (builtins.attrNames doomPackageSet)));
|
2024-03-26 22:28:43 +11:00
|
|
|
|
|
2024-04-28 17:33:43 +10:00
|
|
|
|
# Step 4: build a DOOMDIR, Doom profile and profile loader using Emacs from
|
|
|
|
|
|
# step 3 and packages.el from step 1.
|
2024-03-29 22:54:58 +11:00
|
|
|
|
#
|
2024-04-28 17:33:43 +10:00
|
|
|
|
# Do this all in one derivation because these refer back to each other:
|
|
|
|
|
|
# - init.el in DOOMDIR refers to the straight.el build cache generated along
|
|
|
|
|
|
# with the profile
|
|
|
|
|
|
# - The path to the generated profile is included in the loader
|
|
|
|
|
|
# - Generating the profile depends on the loader
|
2024-03-29 22:54:58 +11:00
|
|
|
|
|
2024-03-26 22:28:43 +11:00
|
|
|
|
# XXX runCommandLocal? (See doomIntermediates.)
|
|
|
|
|
|
doomProfile = runCommand "doom-profile"
|
|
|
|
|
|
{
|
|
|
|
|
|
env = {
|
|
|
|
|
|
EMACS = lib.getExe emacsWithPackages;
|
|
|
|
|
|
# Enable this to troubleshoot failures at this step.
|
|
|
|
|
|
#DEBUG = "1";
|
|
|
|
|
|
};
|
|
|
|
|
|
# Required to avoid Doom erroring out at startup.
|
|
|
|
|
|
nativeBuildInputs = [ git ];
|
2024-03-29 22:54:58 +11:00
|
|
|
|
} ''
|
2024-04-28 17:33:43 +10:00
|
|
|
|
mkdir $out $out/loader $out/doomdir $out/profile $out/straight
|
|
|
|
|
|
ln -s ${doomDir}/* $out/doomdir/
|
|
|
|
|
|
# yasnippet logs an error at startup if snippets/ does not exist.
|
|
|
|
|
|
if ! [[ -e $out/doomdir/snippets ]]; then
|
|
|
|
|
|
mkdir $out/doomdir/snippets
|
|
|
|
|
|
fi
|
|
|
|
|
|
rm $out/doomdir/init.el
|
|
|
|
|
|
substitute ${./init.el} $out/doomdir/init.el \
|
2024-04-28 17:36:21 +10:00
|
|
|
|
--subst-var-by user-init "${doomDir}/init.el" \
|
|
|
|
|
|
--subst-var-by straight-base-dir $out
|
2024-04-28 17:33:43 +10:00
|
|
|
|
ln -sf ${doomIntermediates}/packages.el $out/doomdir/
|
|
|
|
|
|
export DOOMDIR=$out/doomdir
|
|
|
|
|
|
|
2024-03-31 15:44:27 +11:00
|
|
|
|
export DOOMPROFILELOADFILE=$out/loader/init.el
|
2024-04-27 14:31:24 +10:00
|
|
|
|
# DOOMLOCALDIR must be writable, Doom creates some subdirectories.
|
2024-03-29 22:54:58 +11:00
|
|
|
|
export DOOMLOCALDIR=$(mktemp -d)
|
2024-04-25 16:23:55 +10:00
|
|
|
|
${runtimeShell} ${doomSource}/bin/doomscript ${./build-helpers/build-profile-loader} \
|
2024-04-28 17:33:43 +10:00
|
|
|
|
-n "${profileName}" -b "$out" -d "$out/doomdir" ${optionalString noProfileHack "-u"}
|
2024-03-29 22:54:58 +11:00
|
|
|
|
|
|
|
|
|
|
# With DOOMPROFILE set, doom-state-dir and friends are HOME-relative.
|
|
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
|
|
export DOOMPROFILE='${profileName}';
|
2024-04-25 16:23:55 +10:00
|
|
|
|
${runtimeShell} ${doomSource}/bin/doomscript ${./build-helpers/build-profile}
|
2024-03-26 22:28:43 +11:00
|
|
|
|
|
2024-03-31 20:44:24 +11:00
|
|
|
|
# Similar to audit-tmpdir.sh in nixpkgs.
|
|
|
|
|
|
if grep -q -F "$TMPDIR/" -r $out; then
|
|
|
|
|
|
echo "Doom profile contains a forbidden reference to $TMPDIR/"
|
|
|
|
|
|
exit 1
|
|
|
|
|
|
fi
|
|
|
|
|
|
'';
|
2024-03-29 22:54:58 +11:00
|
|
|
|
|
2024-03-31 16:47:48 +11:00
|
|
|
|
# Step 6: write wrappers to start the whole thing.
|
2024-04-27 16:14:28 +10:00
|
|
|
|
doomEmacs = runCommand "doom-emacs" {
|
2024-03-29 22:54:58 +11:00
|
|
|
|
nativeBuildInputs = [ makeBinaryWrapper ];
|
2024-04-27 21:34:44 +10:00
|
|
|
|
} ''
|
2024-04-27 16:14:28 +10:00
|
|
|
|
makeWrapper ${emacsWithPackages}/bin/emacs $out/bin/doom-emacs \
|
2024-03-31 15:44:27 +11:00
|
|
|
|
--set DOOMPROFILELOADFILE ${doomProfile}/loader/init.el \
|
2024-04-25 17:11:07 +10:00
|
|
|
|
--set DOOMPROFILE ${profileName} \
|
2024-04-08 21:43:54 +10:00
|
|
|
|
--set-default DOOMLOCALDIR "${doomLocalDir}" \
|
2024-04-25 17:11:07 +10:00
|
|
|
|
--add-flags "--init-directory=${doomSource}"
|
2024-04-27 21:41:50 +10:00
|
|
|
|
makeWrapper ${doomSource}/bin/doomscript $out/bin/doomscript \
|
|
|
|
|
|
--set EMACS ${emacsWithPackages}/bin/emacs \
|
|
|
|
|
|
--set DOOMPROFILELOADFILE ${doomProfile}/loader/init.el \
|
|
|
|
|
|
--set DOOMPROFILE ${profileName} \
|
|
|
|
|
|
--set-default DOOMLOCALDIR "${doomLocalDir}" \
|
2024-04-27 21:34:44 +10:00
|
|
|
|
'';
|
2024-04-25 22:49:58 +10:00
|
|
|
|
# TODO: revisit wrapping `doom` if/when profile use is optional.
|
|
|
|
|
|
#
|
|
|
|
|
|
# I would like to support `doom doctor` and user commands (from their
|
|
|
|
|
|
# `cli.el)`.
|
|
|
|
|
|
#
|
2024-04-27 21:34:44 +10:00
|
|
|
|
# Wrapping it the same way I wrap emacs, passing EMACS in addition to
|
|
|
|
|
|
# DOOMPROFILELOADFILE, DOOMPROFILE and DOOMLOCALDIR, almost works.
|
2024-04-25 22:49:58 +10:00
|
|
|
|
# But with doomProfile set, `doom doctor` currently fails with
|
|
|
|
|
|
#
|
|
|
|
|
|
# Profile init file hasn’t been generated. Did you forgot to run ’doom sync’?
|
|
|
|
|
|
#
|
|
|
|
|
|
# It looks like this breaks because doom-start wants to load the profile via
|
|
|
|
|
|
# (doom-profile-init-file), which (when called with no arguments) loads the
|
|
|
|
|
|
# default profile.
|
|
|
|
|
|
#
|
|
|
|
|
|
# It is probably possible to hack around that, but let's see if we can make
|
2024-04-27 21:34:44 +10:00
|
|
|
|
# the default profile work first: `doom doctor` may have additional problems
|
|
|
|
|
|
# too hard to solve.
|
2024-04-27 16:14:28 +10:00
|
|
|
|
|
|
|
|
|
|
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
|
2024-04-28 16:50:58 +10:00
|
|
|
|
ln -sf ${doomEmacs}/bin/doomscript $out/bin/
|
2024-04-27 16:14:28 +10:00
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
'';
|
2024-03-04 01:29:47 +11:00
|
|
|
|
in
|
2024-04-27 16:14:28 +10:00
|
|
|
|
{
|
|
|
|
|
|
inherit doomEmacs emacsWithDoom;
|
|
|
|
|
|
}
|