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,
|
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-05-26 22:42:51 +10:00
|
|
|
/* Use fetchTree instead of fetchGit for package fetches. */
|
|
|
|
|
experimentalFetchTree ? false,
|
2024-06-02 00:34:36 +02:00
|
|
|
/* Extra emacs packages from nixpkgs */
|
|
|
|
|
extraPackages ? epkgs: [ ],
|
2024-06-16 22:41:03 +10:00
|
|
|
/* Extra packages to add to $PATH */
|
|
|
|
|
extraBinPackages ? [ git fd ripgrep ],
|
2024-03-04 01:29:47 +11:00
|
|
|
|
2024-06-01 20:11:03 +10:00
|
|
|
callPackage,
|
2024-03-04 15:18:20 +11:00
|
|
|
callPackages,
|
2024-06-16 22:41:03 +10:00
|
|
|
fd,
|
2024-03-26 22:28:43 +11:00
|
|
|
git,
|
2024-06-16 22:41:03 +10:00
|
|
|
ripgrep,
|
2024-03-04 01:29:47 +11:00
|
|
|
emacsPackagesFor,
|
|
|
|
|
lib,
|
2024-05-11 21:32:48 +10:00
|
|
|
runCommandLocal,
|
2024-03-04 01:29:47 +11:00
|
|
|
runtimeShell,
|
2024-03-04 19:19:51 +11:00
|
|
|
writeText,
|
2024-03-29 22:54:58 +11:00
|
|
|
makeBinaryWrapper,
|
2024-06-03 22:52:54 +10:00
|
|
|
stdenv,
|
|
|
|
|
stdenvNoCC,
|
2024-03-04 01:29:47 +11:00
|
|
|
}:
|
|
|
|
|
let
|
2024-04-27 14:53:17 +10:00
|
|
|
inherit (lib) optionalAttrs optionalString;
|
2024-07-02 21:59:49 +10:00
|
|
|
inherit (import ./fetch-overrides.nix) extraPins extraUrls forceDeepCloneDomains;
|
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).
|
|
|
|
|
|
2024-05-11 21:32:48 +10:00
|
|
|
# Force local build in case the user init.el does something weird and to avoid a roundtrip.
|
2024-06-01 20:11:03 +10:00
|
|
|
doomIntermediates = callPackage ./build-helpers/doomscript.nix {
|
|
|
|
|
name = "doom-intermediates";
|
|
|
|
|
inherit doomSource emacs;
|
|
|
|
|
extraArgs = { DOOMDIR = "${doomDir}"; };
|
|
|
|
|
script = ./build-helpers/dump;
|
|
|
|
|
scriptArgs = "-o $out";
|
|
|
|
|
};
|
2024-03-04 01:29:47 +11:00
|
|
|
|
|
|
|
|
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-05-13 22:09:28 +10:00
|
|
|
# If multiple packages are built from the same repository, straight.el pins the repository
|
|
|
|
|
# if only one of them is pinned. Doom relies on this behavior, so try to do the same.
|
|
|
|
|
#
|
|
|
|
|
# We need to do this for dependencies that are not in doomPackageSet. But we don't collect
|
|
|
|
|
# all extra pins here, as that would involve pulling the repository from all packages in
|
|
|
|
|
# esuper. Instead we map repositories to pins, and then do the rest of the work in
|
|
|
|
|
# makePackage.
|
|
|
|
|
|
|
|
|
|
# TODO: refactor url determination out of makePackage, use here?
|
|
|
|
|
# Probably best done at the same time as the codeberg TODO in fetch-overrides.nix.
|
|
|
|
|
repoToPin = let
|
|
|
|
|
# Not unique, but that's ok as this is only used with genAttrs.
|
|
|
|
|
packageNames = lib.attrNames doomPackageSet;
|
|
|
|
|
packageToRepo = lib.genAttrs packageNames (name: esuper.${name}.src.gitRepoUrl or null);
|
|
|
|
|
repoToPackages = lib.zipAttrs
|
|
|
|
|
(lib.mapAttrsToList (name: repo: { ${repo} = name; }) packageToRepo);
|
|
|
|
|
packageToPin = lib.mapAttrs
|
2024-06-22 21:54:11 +10:00
|
|
|
(name: p: extraPins.${name} or p.pin or null) doomPackageSet;
|
2024-05-13 22:09:28 +10:00
|
|
|
repoToPins = lib.mapAttrs (name: packages:
|
|
|
|
|
lib.unique (lib.filter (p: p != null) (map (p: packageToPin.${p}) packages)))
|
|
|
|
|
repoToPackages;
|
|
|
|
|
in
|
|
|
|
|
lib.mapAttrs (name: pins:
|
|
|
|
|
assert lib.assertMsg ((lib.length pins) <= 1) ''
|
|
|
|
|
${name}:
|
|
|
|
|
used by ${lib.concatStringsSep ", " repoToPackages.${name}}
|
|
|
|
|
pinned to different versions ${lib.concatStringsSep ", " pins}
|
|
|
|
|
|
|
|
|
|
nix-doom-emacs-unstraightened assumes these packages would use the same repo
|
|
|
|
|
when Doom Emacs builds them using straight.el, meaning this would not work.
|
|
|
|
|
|
|
|
|
|
If that assumption is correct, this is a bug in Doom Emacs.
|
|
|
|
|
|
|
|
|
|
If that assumption is not correct, this is a bug in Unstraightened.
|
|
|
|
|
|
|
|
|
|
If unsure, report this as a bug in Unstraightened.'';
|
|
|
|
|
lib.findFirst (lib.const true) null pins)
|
|
|
|
|
repoToPins;
|
|
|
|
|
|
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
|
2024-05-13 22:09:28 +10:00
|
|
|
# We're called for all attributes of esuper (to check if they're a package pinned via
|
|
|
|
|
# repoToPin). Some of those attributes are null. So we cannot use `esuper.${name} or
|
|
|
|
|
# null`, we need to explicitly check for presence.
|
|
|
|
|
hasOrigEPkg = esuper ? ${name};
|
|
|
|
|
origEPkg = esuper.${name};
|
2024-06-22 21:54:11 +10:00
|
|
|
pin = extraPins.${name} or p.pin or (
|
2024-05-13 22:09:28 +10:00
|
|
|
# Don't use `url`: this needs to be in sync with repoToPin above.
|
|
|
|
|
# (If we remap ELPA packages to emacs-straight here but not above, it breaks...)
|
|
|
|
|
let repo = esuper.${name}.src.gitRepoUrl or null; in
|
|
|
|
|
if repo != null
|
|
|
|
|
then repoToPin.${repo} or null
|
|
|
|
|
else 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
|
|
|
|
|
|
2024-05-13 22:09:28 +10:00
|
|
|
isElpa = hasOrigEPkg && (
|
2024-05-07 23:19:43 +10:00
|
|
|
origEPkg == esuper.elpaPackages.${name} or null
|
|
|
|
|
|| origEPkg == esuper.nongnuPackages.${name} or null);
|
2024-03-04 01:29:47 +11:00
|
|
|
epkg =
|
2024-05-26 12:35:09 +10:00
|
|
|
if hasOrigEPkg && (pin != null -> !(isElpa || customPackages ? ${name}))
|
|
|
|
|
then origEPkg
|
|
|
|
|
else customPackages.${name}
|
|
|
|
|
or (
|
2024-03-04 01:29:47 +11:00
|
|
|
assert lib.assertMsg
|
2024-07-13 14:22:02 +10:00
|
|
|
(isElpa || (p ? recipe) || extraUrls ? ${name}) ''
|
|
|
|
|
nix-doom-emacs-unstraightened: ${name}: unable to derive repository URL:
|
|
|
|
|
- no recipe provided
|
|
|
|
|
- not an ELPA package
|
|
|
|
|
- not in Unstraightened's fetch-overrides.nix
|
|
|
|
|
|
|
|
|
|
If this is a custom `package!` entry in packages.el, add a `:recipe`.
|
|
|
|
|
'';
|
2024-03-04 01:29:47 +11:00
|
|
|
# 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-07-13 14:22:02 +10:00
|
|
|
assert lib.assertMsg (pin != null) ''
|
|
|
|
|
nix-doom-emacs-unstraightened: ${name}: not in nixpkgs or emacs-overlay, not pinned.
|
|
|
|
|
All packages must be pinned so they can be fetched deterministically.
|
|
|
|
|
|
|
|
|
|
If this is a custom `package!` entry in your packages.el, add a `:pin`.
|
|
|
|
|
If it is a `package!` in Doom, add an entry to Unstraightened's fetch-overrides.nix.
|
|
|
|
|
'';
|
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-06-16 23:34:53 +10: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-05-22 23:41:07 +10:00
|
|
|
# TODO: refactor out the recursive call to makePackage.
|
|
|
|
|
# (Currently needed for dependencies on packages not in epkgs or doom.)
|
|
|
|
|
packageRequires = map (name: eself.${name} or (makePackage name {})) reqlist;
|
2024-06-16 23:34:53 +10:00
|
|
|
}).overrideAttrs (prev: {
|
|
|
|
|
# We only depend on this during evaluation. Force a dependency so it does not
|
|
|
|
|
# get garbage-collected, which slows down subsequent evaluation.
|
|
|
|
|
inherit reqfile;
|
|
|
|
|
postInstall = (prev.postInstall or "") + ''
|
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
|
ln -s $reqfile $out/nix-support/unstraightened-dependencies.json
|
|
|
|
|
'';
|
|
|
|
|
}));
|
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}"
|
2024-05-26 17:06:27 +10:00
|
|
|
else if (p.recipe.type or "git") == "git"
|
2024-05-26 13:38:46 +10:00
|
|
|
&& p ? recipe.repo
|
|
|
|
|
&& (p.recipe.host or null) == null
|
|
|
|
|
then p.recipe.repo
|
2024-06-27 22:36:36 +10:00
|
|
|
else extraUrls.${name}
|
|
|
|
|
or epkg.src.gitRepoUrl
|
2024-03-04 01:29:47 +11:00
|
|
|
or (if isElpa then "https://github.com/emacs-straight/${name}"
|
2024-05-26 13:38:46 +10:00
|
|
|
else (let
|
|
|
|
|
recipe = lib.generators.toPretty {} (p.recipe or "missing");
|
|
|
|
|
in throw "${name}: cannot derive url from recipe ${recipe}"));
|
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-05-26 22:42:51 +10:00
|
|
|
fetchGitArgs = {
|
|
|
|
|
inherit url;
|
|
|
|
|
rev = pin;
|
|
|
|
|
allRefs = true;
|
|
|
|
|
# Skip submodules by default because they seem to be hitting
|
|
|
|
|
# https://github.com/NixOS/nix/issues/10773 (or a similar caching issue) and for
|
|
|
|
|
# parity between fetchTree's github fetcher and fetchGit (Github's exports don't
|
|
|
|
|
# seem to contain submodules).
|
|
|
|
|
submodules = !(p.recipe.nonrecursive or true);
|
|
|
|
|
# TODO: pull ref from derivation.src when 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.
|
2024-05-25 13:18:29 +10:00
|
|
|
|
2024-05-26 22:42:51 +10:00
|
|
|
}
|
2024-06-26 22:48:17 +10:00
|
|
|
// optionalAttrs (p ? recipe.branch) { ref = p.recipe.branch; }
|
2024-07-02 21:41:10 +10:00
|
|
|
// optionalAttrs (p ? recipe.depth) { shallow = p.recipe.depth == 1; }
|
2024-07-02 21:59:49 +10:00
|
|
|
// optionalAttrs (lib.any (d: lib.hasPrefix d url) forceDeepCloneDomains) {
|
|
|
|
|
shallow = false;
|
|
|
|
|
};
|
2024-05-26 22:42:51 +10:00
|
|
|
src =
|
|
|
|
|
if experimentalFetchTree
|
|
|
|
|
then builtins.fetchTree (
|
|
|
|
|
if lib.hasPrefix "https://github.com/" url
|
|
|
|
|
then let
|
|
|
|
|
tail = lib.removePrefix "https://github.com/" url;
|
|
|
|
|
split = lib.splitString "/" tail;
|
|
|
|
|
owner = lib.head split;
|
|
|
|
|
repo = lib.removeSuffix ".git" (lib.elemAt split 1);
|
|
|
|
|
in {
|
|
|
|
|
type = "github";
|
|
|
|
|
inherit owner repo;
|
|
|
|
|
rev = pin;
|
2024-07-02 22:15:19 +10:00
|
|
|
} else if lib.hasPrefix "https://git.sr.ht/" url
|
|
|
|
|
then let
|
|
|
|
|
tail = lib.removePrefix "https://git.sr.ht/" url;
|
|
|
|
|
split = lib.splitString "/" tail;
|
|
|
|
|
owner = lib.head split;
|
|
|
|
|
repo = lib.elemAt split 1;
|
|
|
|
|
in {
|
|
|
|
|
type = "sourcehut";
|
|
|
|
|
inherit owner repo;
|
|
|
|
|
rev = pin;
|
2024-05-26 22:42:51 +10:00
|
|
|
} else ({
|
|
|
|
|
type = "git";
|
|
|
|
|
} // fetchGitArgs))
|
|
|
|
|
else builtins.fetchGit fetchGitArgs;
|
2024-05-11 21:32:48 +10:00
|
|
|
# Run locally to avoid a network roundtrip.
|
2024-06-01 20:54:46 +10:00
|
|
|
reqfile = runCommandLocal "${name}-deps" {
|
|
|
|
|
inherit src;
|
|
|
|
|
emacs = lib.getExe emacs;
|
|
|
|
|
printDeps = ./build-helpers/print-deps.el;
|
|
|
|
|
} "$emacs -Q --batch --script $printDeps $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
|
2024-05-13 22:09:28 +10:00
|
|
|
# Hack: we call makePackage for everything (not just doomPackageSet), just to hit the
|
|
|
|
|
# repoToPin check. We cannot easily call it just for transitive dependencies, because we
|
|
|
|
|
# need makePackage to figure out what the dependencies (for packages not in esuper) are...
|
|
|
|
|
# This seems to work ok in practice because makePackage is called lazily.
|
|
|
|
|
lib.mapAttrs makePackage ((lib.mapAttrs (name: (lib.const {})) esuper) // doomPackageSet)
|
2024-03-04 01:29:47 +11:00
|
|
|
);
|
|
|
|
|
|
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-06-02 01:21:24 +02:00
|
|
|
emacsWithPackages = doomEmacsPackages.emacsWithPackages
|
|
|
|
|
(epkgs: (map (p: epkgs.${p}) (builtins.attrNames doomPackageSet)) ++ (extraPackages epkgs));
|
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-06-03 22:52:54 +10:00
|
|
|
doomProfile = stdenvNoCC.mkDerivation {
|
|
|
|
|
name = "doom-profile";
|
|
|
|
|
buildCommandPath = ./build-helpers/build-doom-profile.sh;
|
2024-04-28 17:33:43 +10:00
|
|
|
|
2024-06-03 22:52:54 +10:00
|
|
|
inherit doomDir doomIntermediates doomSource noProfileHack profileName runtimeShell;
|
|
|
|
|
buildProfileLoader = ./build-helpers/build-profile-loader;
|
|
|
|
|
buildProfile = ./build-helpers/build-profile;
|
|
|
|
|
initEl = ./init.el;
|
|
|
|
|
EMACS = lib.getExe emacsWithPackages;
|
2024-06-22 13:30:32 +10:00
|
|
|
inherit (emacsWithPackages) deps;
|
2024-06-03 22:52:54 +10:00
|
|
|
# Enable this to troubleshoot failures at this step.
|
|
|
|
|
#DEBUG = "1";
|
2024-03-29 22:54:58 +11:00
|
|
|
|
2024-06-03 22:52:54 +10:00
|
|
|
# Required to avoid Doom erroring out at startup.
|
|
|
|
|
nativeBuildInputs = [ git ];
|
|
|
|
|
# Force local build in case the user init.el does something weird.
|
|
|
|
|
preferLocalBuild = true;
|
|
|
|
|
allowSubstitutes = false;
|
|
|
|
|
};
|
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-06-16 22:41:03 +10:00
|
|
|
binPath = lib.makeBinPath extraBinPackages;
|
2024-05-11 21:32:48 +10:00
|
|
|
|
2024-06-03 22:52:54 +10:00
|
|
|
# makeBinaryWrapper pulls in a compiler, so don't force this one local.
|
|
|
|
|
doomEmacs = stdenv.mkDerivation {
|
|
|
|
|
name = "doom-emacs";
|
|
|
|
|
buildCommandPath = ./build-helpers/build-doom-emacs.sh;
|
|
|
|
|
|
2024-06-01 20:54:46 +10:00
|
|
|
# emacsWithPackages also accessed externally (for pushing to Cachix).
|
2024-06-16 22:41:03 +10:00
|
|
|
inherit binPath doomProfile doomLocalDir doomSource emacsWithPackages profileName;
|
2024-06-03 22:52:54 +10:00
|
|
|
|
2024-03-29 22:54:58 +11:00
|
|
|
nativeBuildInputs = [ makeBinaryWrapper ];
|
2024-06-03 22:52:54 +10:00
|
|
|
};
|
2024-04-27 16:14:28 +10:00
|
|
|
|
2024-06-03 22:52:54 +10:00
|
|
|
emacsWithDoom = stdenvNoCC.mkDerivation {
|
|
|
|
|
inherit (lib.appendToName "with-doom" emacs) name;
|
2024-04-27 16:14:28 +10:00
|
|
|
inherit (emacs) meta;
|
2024-06-01 20:54:46 +10:00
|
|
|
inherit doomEmacs emacs;
|
2024-06-03 22:52:54 +10:00
|
|
|
buildCommandPath = ./build-helpers/build-emacs-with-doom.sh;
|
2024-04-27 16:14:28 +10:00
|
|
|
|
2024-06-03 22:52:54 +10:00
|
|
|
# Force local build as it's near-trivial.
|
|
|
|
|
preferLocalBuild = true;
|
|
|
|
|
allowSubstitutes = false;
|
|
|
|
|
};
|
2024-03-04 01:29:47 +11:00
|
|
|
in
|
2024-04-27 16:14:28 +10:00
|
|
|
{
|
2024-06-01 20:37:09 +10:00
|
|
|
inherit doomEmacs emacsWithDoom;
|
2024-04-27 16:14:28 +10:00
|
|
|
}
|