diff options
Diffstat (limited to 'pkgs/applications/editors/emacs')
68 files changed, 5394 insertions, 6168 deletions
diff --git a/pkgs/applications/editors/emacs/build-support/elpa.nix b/pkgs/applications/editors/emacs/build-support/elpa.nix index 6dd0c7f167c9..5a8f0ab9e52c 100644 --- a/pkgs/applications/editors/emacs/build-support/elpa.nix +++ b/pkgs/applications/editors/emacs/build-support/elpa.nix @@ -1,28 +1,31 @@ # builder for Emacs packages built for packages.el -{ lib, stdenv, emacs, texinfo, writeText, gcc }: +{ lib, stdenv, emacs, texinfo, writeText }: let - handledArgs = [ "meta" ]; - genericBuild = import ./generic.nix { inherit lib stdenv emacs texinfo writeText gcc; }; + genericBuild = import ./generic.nix { inherit lib stdenv emacs texinfo writeText; }; + libBuildHelper = import ./lib-build-helper.nix; in +libBuildHelper.extendMkDerivation' genericBuild (finalAttrs: + { pname -, version -, src +, dontUnpack ? true , meta ? {} , ... }@args: -genericBuild ({ +{ + + elpa2nix = args.elpa2nix or ./elpa2nix.el; - dontUnpack = true; + inherit dontUnpack; - installPhase = '' + installPhase = args.installPhase or '' runHook preInstall - emacs --batch -Q -l ${./elpa2nix.el} \ + emacs --batch -Q -l "$elpa2nix" \ -f elpa2nix-install-package \ "$src" "$out/share/emacs/site-lisp/elpa" @@ -34,4 +37,4 @@ genericBuild ({ } // meta; } -// removeAttrs args handledArgs) +) diff --git a/pkgs/applications/editors/emacs/build-support/generic.nix b/pkgs/applications/editors/emacs/build-support/generic.nix index 727b1f03cae4..3ff10ee865fb 100644 --- a/pkgs/applications/editors/emacs/build-support/generic.nix +++ b/pkgs/applications/editors/emacs/build-support/generic.nix @@ -1,11 +1,9 @@ # generic builder for Emacs packages -{ lib, stdenv, emacs, texinfo, writeText, gcc, ... }: +{ lib, stdenv, emacs, texinfo, writeText, ... }: let - inherit (lib) optionalAttrs getLib; - handledArgs = [ "buildInputs" "packageRequires" "propagatedUserEnvPkgs" "meta" ] - ++ lib.optionals (emacs.withNativeCompilation or false) [ "nativeBuildInputs" "postInstall" ]; + inherit (lib) optionalAttrs; setupHook = writeText "setup-hook.sh" '' source ${./emacs-funcs.sh} @@ -21,13 +19,16 @@ let fi ''; + libBuildHelper = import ./lib-build-helper.nix; + in -{ pname -, version -, buildInputs ? [] +libBuildHelper.extendMkDerivation' stdenv.mkDerivation (finalAttrs: + +{ buildInputs ? [] , nativeBuildInputs ? [] , packageRequires ? [] +, propagatedBuildInputs ? [] , propagatedUserEnvPkgs ? [] , postInstall ? "" , meta ? {} @@ -36,10 +37,10 @@ in , ... }@args: -stdenv.mkDerivation (finalAttrs: ({ - name = "emacs-${pname}-${finalAttrs.version}"; +{ + name = args.name or "emacs-${finalAttrs.pname}-${finalAttrs.version}"; - unpackCmd = '' + unpackCmd = args.unpackCmd or '' case "$curSrc" in *.el) # keep original source filename without the hash @@ -55,13 +56,13 @@ stdenv.mkDerivation (finalAttrs: ({ esac ''; - buildInputs = [emacs texinfo] ++ packageRequires ++ buildInputs; - propagatedBuildInputs = packageRequires; - propagatedUserEnvPkgs = packageRequires ++ propagatedUserEnvPkgs; - - inherit setupHook; + inherit packageRequires; + buildInputs = finalAttrs.packageRequires ++ buildInputs; + nativeBuildInputs = [ emacs texinfo ] ++ nativeBuildInputs; + propagatedBuildInputs = finalAttrs.packageRequires ++ propagatedBuildInputs; + propagatedUserEnvPkgs = finalAttrs.packageRequires ++ propagatedUserEnvPkgs; - doCheck = false; + setupHook = args.setupHook or setupHook; meta = { broken = false; @@ -73,11 +74,7 @@ stdenv.mkDerivation (finalAttrs: ({ // optionalAttrs (emacs.withNativeCompilation or false) { - LIBRARY_PATH = "${getLib stdenv.cc.libc}/lib"; - - nativeBuildInputs = [ gcc ] ++ nativeBuildInputs; - - addEmacsNativeLoadPath = true; + addEmacsNativeLoadPath = args.addEmacsNativeLoadPath or true; inherit turnCompilationWarningToError ignoreCompilationError; @@ -100,4 +97,4 @@ stdenv.mkDerivation (finalAttrs: ({ '' + postInstall; } -// removeAttrs args handledArgs)) +) diff --git a/pkgs/applications/editors/emacs/build-support/lib-build-helper.nix b/pkgs/applications/editors/emacs/build-support/lib-build-helper.nix new file mode 100644 index 000000000000..23267f592359 --- /dev/null +++ b/pkgs/applications/editors/emacs/build-support/lib-build-helper.nix @@ -0,0 +1,5 @@ +{ + extendMkDerivation' = + mkDerivationBase: attrsOverlay: fpargs: + (mkDerivationBase fpargs).overrideAttrs attrsOverlay; +} diff --git a/pkgs/applications/editors/emacs/build-support/melpa.nix b/pkgs/applications/editors/emacs/build-support/melpa.nix index 6249f4e7f186..e129e3ebdeb0 100644 --- a/pkgs/applications/editors/emacs/build-support/melpa.nix +++ b/pkgs/applications/editors/emacs/build-support/melpa.nix @@ -1,11 +1,11 @@ # builder for Emacs packages built for packages.el # using MELPA package-build.el -{ lib, stdenv, fetchFromGitHub, emacs, texinfo, writeText, gcc }: +{ lib, stdenv, fetchFromGitHub, emacs, texinfo, writeText }: let - handledArgs = [ "meta" "preUnpack" "postUnpack" ]; - genericBuild = import ./generic.nix { inherit lib stdenv emacs texinfo writeText gcc; }; + genericBuild = import ./generic.nix { inherit lib stdenv emacs texinfo writeText; }; + libBuildHelper = import ./lib-build-helper.nix; packageBuild = stdenv.mkDerivation { name = "package-build"; @@ -29,6 +29,8 @@ let in +libBuildHelper.extendMkDerivation' genericBuild (finalAttrs: + { /* pname: Nix package name without special symbols and without version or "emacs-" prefix. @@ -51,7 +53,7 @@ in This will be written into the generated package but it is not needed during the build process. */ -, commit ? (args.src.rev or "unknown") +, commit ? (finalAttrs.src.rev or "unknown") /* files: Optional recipe property specifying the files used to build the package. If null, do not set it in recipe, keeping the default upstream behaviour. @@ -61,25 +63,26 @@ in /* recipe: Optional MELPA recipe. Default: a minimally functional recipe + This can be a path of a recipe file, a string of the recipe content or an empty string. + The default value is used if it is an empty string. */ -, recipe ? (writeText "${pname}-recipe" '' - (${ename} :fetcher git :url "" - ${lib.optionalString (files != null) ":files ${files}"}) - '') +, recipe ? "" , preUnpack ? "" , postUnpack ? "" , meta ? {} , ... }@args: -genericBuild ({ +{ + + elpa2nix = args.elpa2nix or ./elpa2nix.el; + melpa2nix = args.melpa2nix or ./melpa2nix.el; - elpa2nix = ./elpa2nix.el; - melpa2nix = ./melpa2nix.el; + inherit commit ename files recipe; - inherit packageBuild commit ename recipe; + packageBuild = args.packageBuild or packageBuild; - melpaVersion = + melpaVersion = args.melpaVersion or ( let parsed = lib.flip builtins.match version # match <version>-unstable-YYYY-MM-DD format @@ -90,13 +93,25 @@ genericBuild ({ in if unstableVersionInNixFormat then date + "." + time - else version; + else finalAttrs.version); preUnpack = '' mkdir -p "$NIX_BUILD_TOP/recipes" - if [ -n "$recipe" ]; then - cp "$recipe" "$NIX_BUILD_TOP/recipes/$ename" + recipeFile="$NIX_BUILD_TOP/recipes/$ename" + if [ -r "$recipe" ]; then + ln -s "$recipe" "$recipeFile" + nixInfoLog "link recipe" + elif [ -n "$recipe" ]; then + printf "%s" "$recipe" > "$recipeFile" + nixInfoLog "write recipe" + else + cat > "$recipeFile" <<'EOF' +(${finalAttrs.ename} :fetcher git :url "" ${lib.optionalString (finalAttrs.files != null) ":files ${finalAttrs.files}"}) +EOF + nixInfoLog "use default recipe" fi + nixInfoLog "recipe content:" "$(< $recipeFile)" + unset -v recipeFile ln -s "$packageBuild" "$NIX_BUILD_TOP/package-build" @@ -108,10 +123,15 @@ genericBuild ({ ln -s "$NIX_BUILD_TOP/$sourceRoot" "$NIX_BUILD_TOP/working/$ename" '' + postUnpack; - buildPhase = '' + buildPhase = args.buildPhase or '' runHook preBuild - cd "$NIX_BUILD_TOP" + # This is modified from stdenv buildPhase. foundMakefile is used in stdenv checkPhase. + if [[ ! ( -z "''${makeFlags-}" && -z "''${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ) ]]; then + foundMakefile=1 + fi + + pushd "$NIX_BUILD_TOP" emacs --batch -Q \ -L "$NIX_BUILD_TOP/package-build" \ @@ -119,10 +139,12 @@ genericBuild ({ -f melpa2nix-build-package \ $ename $melpaVersion $commit + popd + runHook postBuild ''; - installPhase = '' + installPhase = args.installPhase or '' runHook preInstall archive="$NIX_BUILD_TOP/packages/$ename-$melpaVersion.el" @@ -143,4 +165,4 @@ genericBuild ({ } // meta; } -// removeAttrs args handledArgs) +) diff --git a/pkgs/applications/editors/emacs/build-support/trivial.nix b/pkgs/applications/editors/emacs/build-support/trivial.nix index 11c28c0133e4..8c515363f427 100644 --- a/pkgs/applications/editors/emacs/build-support/trivial.nix +++ b/pkgs/applications/editors/emacs/build-support/trivial.nix @@ -2,27 +2,37 @@ { callPackage, lib, ... }@envargs: +let + libBuildHelper = import ./lib-build-helper.nix; +in + +libBuildHelper.extendMkDerivation' (callPackage ./generic.nix envargs) (finalAttrs: + args: -callPackage ./generic.nix envargs ({ - buildPhase = '' +{ + buildPhase = args.buildPhase or '' runHook preBuild + # This is modified from stdenv buildPhase. foundMakefile is used in stdenv checkPhase. + if [[ ! ( -z "''${makeFlags-}" && -z "''${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ) ]]; then + foundMakefile=1 + fi + emacs -L . --batch -f batch-byte-compile *.el runHook postBuild ''; - installPhase = '' + installPhase = args.installPhase or '' runHook preInstall LISPDIR=$out/share/emacs/site-lisp install -d $LISPDIR install *.el *.elc $LISPDIR - emacs --batch -l package --eval "(package-generate-autoloads \"${args.pname}\" \"$LISPDIR\")" runHook postInstall ''; } -// args) +) diff --git a/pkgs/applications/editors/emacs/build-support/wrapper.nix b/pkgs/applications/editors/emacs/build-support/wrapper.nix index 59a694286d09..5b325f5e0a9e 100644 --- a/pkgs/applications/editors/emacs/build-support/wrapper.nix +++ b/pkgs/applications/editors/emacs/build-support/wrapper.nix @@ -32,7 +32,7 @@ in customEmacsPackages.withPackages (epkgs: [ epkgs.evil epkgs.magit ]) */ -{ lib, lndir, makeBinaryWrapper, runCommand, gcc }: +{ lib, lndir, makeBinaryWrapper, runCommand }: self: let inherit (self) emacs; @@ -60,7 +60,6 @@ runCommand deps = runCommand "emacs-packages-deps" ({ inherit explicitRequires lndir emacs; - nativeBuildInputs = lib.optional withNativeCompilation gcc; } // lib.optionalAttrs withNativeCompilation { inherit (emacs) LIBRARY_PATH; }) diff --git a/pkgs/applications/editors/emacs/elisp-packages/elpa-devel-generated.nix b/pkgs/applications/editors/emacs/elisp-packages/elpa-devel-generated.nix index acfafcacbef8..f01f841edbe5 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/elpa-devel-generated.nix +++ b/pkgs/applications/editors/emacs/elisp-packages/elpa-devel-generated.nix @@ -17,7 +17,7 @@ }; packageRequires = [ avy ]; meta = { - homepage = "https://elpa.gnu.org/packages/ace-window.html"; + homepage = "https://elpa.gnu.org/devel/ace-window.html"; license = lib.licenses.free; }; } @@ -38,7 +38,7 @@ }; packageRequires = [ ]; meta = { - homepage = "https://elpa.gnu.org/packages/ack.html"; + homepage = "https://elpa.gnu.org/devel/ack.html"; license = lib.licenses.free; }; } @@ -46,7 +46,6 @@ activities = callPackage ( { elpaBuild, - emacs, fetchurl, lib, persist, @@ -54,17 +53,14 @@ elpaBuild { pname = "activities"; ename = "activities"; - version = "0.8pre0.20240709.193836"; + version = "0.8pre0.20240727.5721"; src = fetchurl { - url = "https://elpa.gnu.org/devel/activities-0.8pre0.20240709.193836.tar"; - sha256 = "1spvk9z1gc522nq36mhyvn86cq9j64c |