From 3b82c96f7e3a872714ef0702cd186f65c28a7a6c Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Fri, 26 Jul 2024 02:36:33 +0800 Subject: [PATCH 1/9] emacs: fix name when pname is overridden Before nix-repl> (emacs.pkgs.magit.overrideAttrs (old: { pname = old.pname + "-patched"; })).name "emacs-magit-20240522.204" After nix-repl> (emacs.pkgs.magit.overrideAttrs (old: { pname = old.pname + "-patched"; })).name "emacs-magit-patched-20240522.204" --- pkgs/applications/editors/emacs/build-support/generic.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/editors/emacs/build-support/generic.nix b/pkgs/applications/editors/emacs/build-support/generic.nix index 3b3298cd1468..afccde30f1bf 100644 --- a/pkgs/applications/editors/emacs/build-support/generic.nix +++ b/pkgs/applications/editors/emacs/build-support/generic.nix @@ -37,7 +37,7 @@ in }@args: stdenv.mkDerivation (finalAttrs: ({ - name = "emacs-${pname}-${finalAttrs.version}"; + name = "emacs-${finalAttrs.pname}-${finalAttrs.version}"; unpackCmd = '' case "$curSrc" in From 675dcef30ad23f3b17066c7b11722f581b90798c Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Sat, 27 Jul 2024 06:54:08 +0800 Subject: [PATCH 2/9] emacs: remove redundant doCheck from genericBuild The default value of doCheck is false. --- pkgs/applications/editors/emacs/build-support/generic.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/applications/editors/emacs/build-support/generic.nix b/pkgs/applications/editors/emacs/build-support/generic.nix index afccde30f1bf..16632e97eca0 100644 --- a/pkgs/applications/editors/emacs/build-support/generic.nix +++ b/pkgs/applications/editors/emacs/build-support/generic.nix @@ -62,8 +62,6 @@ stdenv.mkDerivation (finalAttrs: ({ inherit setupHook; - doCheck = false; - meta = { broken = false; platforms = emacs.meta.platforms; From cdf4aef5e2ad2c50872f8948656f21df9e8325f4 Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Sun, 28 Jul 2024 08:46:02 +0800 Subject: [PATCH 3/9] emacs: handle propagatedBuildInputs correctly for genericBuild Without this patch, if there is propagatedBuildInputs in the arguments of genericBuild, it will override the value set by genericBuild. With this patch applied, the argument and the value set by genericBuild are merged instead. --- pkgs/applications/editors/emacs/build-support/generic.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/editors/emacs/build-support/generic.nix b/pkgs/applications/editors/emacs/build-support/generic.nix index 16632e97eca0..d529d3cf09f9 100644 --- a/pkgs/applications/editors/emacs/build-support/generic.nix +++ b/pkgs/applications/editors/emacs/build-support/generic.nix @@ -4,7 +4,7 @@ let inherit (lib) optionalAttrs; - handledArgs = [ "buildInputs" "nativeBuildInputs" "packageRequires" "propagatedUserEnvPkgs" "meta" ] + handledArgs = [ "buildInputs" "nativeBuildInputs" "packageRequires" "propagatedBuildInputs" "propagatedUserEnvPkgs" "meta" ] ++ lib.optionals (emacs.withNativeCompilation or false) [ "postInstall" ]; setupHook = writeText "setup-hook.sh" '' @@ -28,6 +28,7 @@ in , buildInputs ? [] , nativeBuildInputs ? [] , packageRequires ? [] +, propagatedBuildInputs ? [] , propagatedUserEnvPkgs ? [] , postInstall ? "" , meta ? {} @@ -57,7 +58,7 @@ stdenv.mkDerivation (finalAttrs: ({ buildInputs = packageRequires ++ buildInputs; nativeBuildInputs = [ emacs texinfo ] ++ nativeBuildInputs; - propagatedBuildInputs = packageRequires; + propagatedBuildInputs = packageRequires ++ propagatedBuildInputs; propagatedUserEnvPkgs = packageRequires ++ propagatedUserEnvPkgs; inherit setupHook; From 84c2e0096d0c365e3f2a81ad8533c5b8910e7a73 Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Sun, 28 Jul 2024 10:21:18 +0800 Subject: [PATCH 4/9] emacs: stop generating autoload file for trivialBuild When Emacs starts, package-activate-all finds autoload files and loads them. However, the autoload file generated by trivialBuild is never picked up by package-activate-all. In other words, this feature never works. So let's remove it. --- pkgs/applications/editors/emacs/build-support/trivial.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/applications/editors/emacs/build-support/trivial.nix b/pkgs/applications/editors/emacs/build-support/trivial.nix index 11c28c0133e4..522dec811865 100644 --- a/pkgs/applications/editors/emacs/build-support/trivial.nix +++ b/pkgs/applications/editors/emacs/build-support/trivial.nix @@ -19,7 +19,6 @@ callPackage ./generic.nix envargs ({ 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 ''; From 37df73d3d8314e6b96cb1ccb7cd91ed796bdfa3a Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Sun, 28 Jul 2024 12:27:52 +0800 Subject: [PATCH 5/9] emacs: teach elisp builders the finalAttrs pattern This commit causes 0 rebuilds. The performance overhead of eval time is as follows: | package set | before | after | changed | |--------------------------|--------|-------|---------| | emacs.pkgs.elpaPackages | 1.925 | 1.935 | +0.35% | | emacs.pkgs.melpaPackages | 8.312 | 8.558 | +3.0% | The commands used here are nix nixpkgs#hyperfine -- --warmup 2 --runs 10 'NIXPKGS_ALLOW_BROKEN=1 nix eval --include nixpkgs=$PWD --file . emacs.pkgs.melpaPackages --apply \'pkgSet: map (drv: drv.drvPath) (builtins.filter (p: p.type or null == "derivation") (builtins.attrValues pkgSet))\' --no-eval-cache >/dev/null' nix nixpkgs#hyperfine -- --warmup 10 --runs 30 'NIXPKGS_ALLOW_BROKEN=1 nix eval --include nixpkgs=$PWD --file . emacs.pkgs.elpaPackages --apply \'pkgSet: map (drv: drv.drvPath) (builtins.filter (p: p.type or null == "derivation") (builtins.attrValues pkgSet))\' --no-eval-cache >/dev/null' --- .../editors/emacs/build-support/elpa.nix | 13 +++-- .../editors/emacs/build-support/generic.nix | 8 ++- .../emacs/build-support/lib-build-helper.nix | 56 +++++++++++++++++++ .../editors/emacs/build-support/melpa.nix | 32 ++++++----- .../editors/emacs/build-support/trivial.nix | 20 +++++-- 5 files changed, 103 insertions(+), 26 deletions(-) create mode 100644 pkgs/applications/editors/emacs/build-support/lib-build-helper.nix diff --git a/pkgs/applications/editors/emacs/build-support/elpa.nix b/pkgs/applications/editors/emacs/build-support/elpa.nix index 7ac8d673346a..c87457ff16d9 100644 --- a/pkgs/applications/editors/emacs/build-support/elpa.nix +++ b/pkgs/applications/editors/emacs/build-support/elpa.nix @@ -3,23 +3,26 @@ { lib, stdenv, emacs, texinfo, writeText }: let - handledArgs = [ "meta" ]; genericBuild = import ./generic.nix { inherit lib stdenv emacs texinfo writeText; }; + libBuildHelper = import ./lib-build-helper.nix { inherit lib; }; in +libBuildHelper.extendMkDerivation { } genericBuild (finalAttrs: + { pname , version , src +, dontUnpack ? true , meta ? {} , ... }@args: -genericBuild ({ +{ - dontUnpack = true; + inherit dontUnpack; - installPhase = '' + installPhase = args.installPhase or '' runHook preInstall emacs --batch -Q -l ${./elpa2nix.el} \ @@ -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 d529d3cf09f9..914387979fc2 100644 --- a/pkgs/applications/editors/emacs/build-support/generic.nix +++ b/pkgs/applications/editors/emacs/build-support/generic.nix @@ -21,8 +21,12 @@ let fi ''; + libBuildHelper = import ./lib-build-helper.nix { inherit lib; }; + in +libBuildHelper.adaptMkDerivation { } stdenv.mkDerivation (finalAttrs: + { pname , version , buildInputs ? [] @@ -37,7 +41,7 @@ in , ... }@args: -stdenv.mkDerivation (finalAttrs: ({ +{ name = "emacs-${finalAttrs.pname}-${finalAttrs.version}"; unpackCmd = '' @@ -96,4 +100,4 @@ stdenv.mkDerivation (finalAttrs: ({ '' + postInstall; } -// removeAttrs args handledArgs)) +// 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..7ae7003c9352 --- /dev/null +++ b/pkgs/applications/editors/emacs/build-support/lib-build-helper.nix @@ -0,0 +1,56 @@ +# stolen from https://github.com/NixOS/nixpkgs/pull/234651 +# TODO switch to functions in that PR once it is merged + +{ lib }: + +let + inherit (lib) + setFunctionArgs + id + functionArgs + optionalAttrs + toFunction + ; +in +{ + + extendMkDerivation = + { + modify ? id, + inheritFunctionArgs ? true, + }: + mkDerivationBase: attrsOverlay: + setFunctionArgs + # Adds the fixed-point style support. + (fpargs: modify ((mkDerivationBase fpargs).overrideAttrs attrsOverlay)) + # Add __functionArgs + ( + # Inherit the __functionArgs from the base build helper + functionArgs (attrsOverlay { }) + # Recover the __functionArgs from the derived build helper + // optionalAttrs inheritFunctionArgs (functionArgs mkDerivationBase) + ) + // { + # Passthru attributes attached to the result build helper. + attrsOverlays = mkDerivationBase.attrsOverlays or [ ] ++ [ attrsOverlay ]; + }; + + adaptMkDerivation = + { + modify ? id, + inheritFunctionArgs ? true, + }: + mkDerivationBase: adaptArgs: + setFunctionArgs + # Adds the fixed-point style support + ( + fpargs: modify (mkDerivationBase (finalAttrs: adaptArgs finalAttrs (toFunction fpargs finalAttrs))) + ) + # Add __functionArgs + ( + # Inherit the __functionArgs from the base build helper + optionalAttrs inheritFunctionArgs (functionArgs mkDerivationBase) + # Recover the __functionArgs from the derived build helper + // functionArgs (adaptArgs { }) + ); +} diff --git a/pkgs/applications/editors/emacs/build-support/melpa.nix b/pkgs/applications/editors/emacs/build-support/melpa.nix index 20f7e79eb683..c5adaac76548 100644 --- a/pkgs/applications/editors/emacs/build-support/melpa.nix +++ b/pkgs/applications/editors/emacs/build-support/melpa.nix @@ -4,8 +4,8 @@ { lib, stdenv, fetchFromGitHub, emacs, texinfo, writeText }: let - handledArgs = [ "meta" "preUnpack" "postUnpack" ]; genericBuild = import ./generic.nix { inherit lib stdenv emacs texinfo writeText; }; + libBuildHelper = import ./lib-build-helper.nix { inherit lib; }; 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. @@ -62,9 +64,9 @@ in recipe: Optional MELPA recipe. Default: a minimally functional recipe */ -, recipe ? (writeText "${pname}-recipe" '' - (${ename} :fetcher git :url "" - ${lib.optionalString (files != null) ":files ${files}"}) +, recipe ? (writeText "${finalAttrs.pname}-recipe" '' + (${finalAttrs.ename} :fetcher git :url "" + ${lib.optionalString (finalAttrs.files or null != null) ":files ${finalAttrs.files}"}) '') , preUnpack ? "" , postUnpack ? "" @@ -72,14 +74,16 @@ in , ... }@args: -genericBuild ({ +{ + + elpa2nix = args.elpa2nix or ./elpa2nix.el; + melpa2nix = args.melpa2nix or ./melpa2nix.el; - elpa2nix = ./elpa2nix.el; - melpa2nix = ./melpa2nix.el; + inherit commit ename recipe; - inherit packageBuild commit ename recipe; + packageBuild = args.packageBuild or packageBuild; - melpaVersion = + melpaVersion = args.melpaVersion or ( let parsed = lib.flip builtins.match version # match -unstable-YYYY-MM-DD format @@ -90,7 +94,7 @@ genericBuild ({ in if unstableVersionInNixFormat then date + "." + time - else version; + else finalAttrs.version); preUnpack = '' mkdir -p "$NIX_BUILD_TOP/recipes" @@ -108,7 +112,7 @@ genericBuild ({ ln -s "$NIX_BUILD_TOP/$sourceRoot" "$NIX_BUILD_TOP/working/$ename" '' + postUnpack; - buildPhase = '' + buildPhase = args.buildPhase or '' runHook preBuild cd "$NIX_BUILD_TOP" @@ -122,7 +126,7 @@ genericBuild ({ runHook postBuild ''; - installPhase = '' + installPhase = args.installPhase or '' runHook preInstall archive="$NIX_BUILD_TOP/packages/$ename-$melpaVersion.el" @@ -143,4 +147,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 522dec811865..71606d463a82 100644 --- a/pkgs/applications/editors/emacs/build-support/trivial.nix +++ b/pkgs/applications/editors/emacs/build-support/trivial.nix @@ -2,10 +2,20 @@ { callPackage, lib, ... }@envargs: -args: +let + libBuildHelper = import ./lib-build-helper.nix { inherit lib; }; +in -callPackage ./generic.nix envargs ({ - buildPhase = '' +libBuildHelper.extendMkDerivation { } (callPackage ./generic.nix envargs) (finalAttrs: + +{ pname +, version +, src +, ... +}@args: + +{ + buildPhase = args.buildPhase or '' runHook preBuild emacs -L . --batch -f batch-byte-compile *.el @@ -13,7 +23,7 @@ callPackage ./generic.nix envargs ({ runHook postBuild ''; - installPhase = '' + installPhase = args.installPhase or '' runHook preInstall LISPDIR=$out/share/emacs/site-lisp @@ -24,4 +34,4 @@ callPackage ./generic.nix envargs ({ ''; } -// args) +) From 5248f6f8ef5bae4f848adf9865ee1cd792707f0e Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Sun, 4 Aug 2024 08:56:14 +0800 Subject: [PATCH 6/9] emacs: stop vendoring PR #234651 Previously, we vendor PR #234651 because we want to keep the old behavior of filtering out packageRequires from the arguments we pass to the underling stdenv.mkDerivation. Doing so raises the concern about the complexity of PR #234651. Considering that passing packageRequires to stdenv.mkDerivation also works well, we stop filtering it out and stop vendoring PR #234651. Now, this PR only uses the existing interface of stdenv.mkDerivation. Even though the name of the build helper is still extendMkDerivation', it is nothing new and has been used in Nixpkgs, such as php.buildComposerProject[1]. [1]: https://github.com/NixOS/nixpkgs/blob/f3834de3782b82bfc666abf664f946d0e7d1f116/pkgs/build-support/php/builders/v1/build-composer-project.nix#L108 --- .../editors/emacs/build-support/elpa.nix | 4 +- .../editors/emacs/build-support/generic.nix | 23 ++++---- .../emacs/build-support/lib-build-helper.nix | 57 +------------------ .../editors/emacs/build-support/melpa.nix | 4 +- .../editors/emacs/build-support/trivial.nix | 4 +- 5 files changed, 20 insertions(+), 72 deletions(-) diff --git a/pkgs/applications/editors/emacs/build-support/elpa.nix b/pkgs/applications/editors/emacs/build-support/elpa.nix index c87457ff16d9..3e40cd6df56b 100644 --- a/pkgs/applications/editors/emacs/build-support/elpa.nix +++ b/pkgs/applications/editors/emacs/build-support/elpa.nix @@ -4,11 +4,11 @@ let genericBuild = import ./generic.nix { inherit lib stdenv emacs texinfo writeText; }; - libBuildHelper = import ./lib-build-helper.nix { inherit lib; }; + libBuildHelper = import ./lib-build-helper.nix; in -libBuildHelper.extendMkDerivation { } genericBuild (finalAttrs: +libBuildHelper.extendMkDerivation' genericBuild (finalAttrs: { pname , version diff --git a/pkgs/applications/editors/emacs/build-support/generic.nix b/pkgs/applications/editors/emacs/build-support/generic.nix index 914387979fc2..a3943dda188c 100644 --- a/pkgs/applications/editors/emacs/build-support/generic.nix +++ b/pkgs/applications/editors/emacs/build-support/generic.nix @@ -4,8 +4,6 @@ let inherit (lib) optionalAttrs; - handledArgs = [ "buildInputs" "nativeBuildInputs" "packageRequires" "propagatedBuildInputs" "propagatedUserEnvPkgs" "meta" ] - ++ lib.optionals (emacs.withNativeCompilation or false) [ "postInstall" ]; setupHook = writeText "setup-hook.sh" '' source ${./emacs-funcs.sh} @@ -21,11 +19,11 @@ let fi ''; - libBuildHelper = import ./lib-build-helper.nix { inherit lib; }; + libBuildHelper = import ./lib-build-helper.nix; in -libBuildHelper.adaptMkDerivation { } stdenv.mkDerivation (finalAttrs: +libBuildHelper.extendMkDerivation' stdenv.mkDerivation (finalAttrs: { pname , version @@ -42,9 +40,9 @@ libBuildHelper.adaptMkDerivation { } stdenv.mkDerivation (finalAttrs: }@args: { - name = "emacs-${finalAttrs.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 @@ -60,12 +58,13 @@ libBuildHelper.adaptMkDerivation { } stdenv.mkDerivation (finalAttrs: esac ''; - buildInputs = packageRequires ++ buildInputs; + inherit packageRequires; + buildInputs = finalAttrs.packageRequires ++ buildInputs; nativeBuildInputs = [ emacs texinfo ] ++ nativeBuildInputs; - propagatedBuildInputs = packageRequires ++ propagatedBuildInputs; - propagatedUserEnvPkgs = packageRequires ++ propagatedUserEnvPkgs; + propagatedBuildInputs = finalAttrs.packageRequires ++ propagatedBuildInputs; + propagatedUserEnvPkgs = finalAttrs.packageRequires ++ propagatedUserEnvPkgs; - inherit setupHook; + setupHook = args.setupHook or setupHook; meta = { broken = false; @@ -77,7 +76,7 @@ libBuildHelper.adaptMkDerivation { } stdenv.mkDerivation (finalAttrs: // optionalAttrs (emacs.withNativeCompilation or false) { - addEmacsNativeLoadPath = true; + addEmacsNativeLoadPath = args.addEmacsNativeLoadPath or true; inherit turnCompilationWarningToError ignoreCompilationError; @@ -100,4 +99,4 @@ libBuildHelper.adaptMkDerivation { } 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 index 7ae7003c9352..23267f592359 100644 --- a/pkgs/applications/editors/emacs/build-support/lib-build-helper.nix +++ b/pkgs/applications/editors/emacs/build-support/lib-build-helper.nix @@ -1,56 +1,5 @@ -# stolen from https://github.com/NixOS/nixpkgs/pull/234651 -# TODO switch to functions in that PR once it is merged - -{ lib }: - -let - inherit (lib) - setFunctionArgs - id - functionArgs - optionalAttrs - toFunction - ; -in { - - extendMkDerivation = - { - modify ? id, - inheritFunctionArgs ? true, - }: - mkDerivationBase: attrsOverlay: - setFunctionArgs - # Adds the fixed-point style support. - (fpargs: modify ((mkDerivationBase fpargs).overrideAttrs attrsOverlay)) - # Add __functionArgs - ( - # Inherit the __functionArgs from the base build helper - functionArgs (attrsOverlay { }) - # Recover the __functionArgs from the derived build helper - // optionalAttrs inheritFunctionArgs (functionArgs mkDerivationBase) - ) - // { - # Passthru attributes attached to the result build helper. - attrsOverlays = mkDerivationBase.attrsOverlays or [ ] ++ [ attrsOverlay ]; - }; - - adaptMkDerivation = - { - modify ? id, - inheritFunctionArgs ? true, - }: - mkDerivationBase: adaptArgs: - setFunctionArgs - # Adds the fixed-point style support - ( - fpargs: modify (mkDerivationBase (finalAttrs: adaptArgs finalAttrs (toFunction fpargs finalAttrs))) - ) - # Add __functionArgs - ( - # Inherit the __functionArgs from the base build helper - optionalAttrs inheritFunctionArgs (functionArgs mkDerivationBase) - # Recover the __functionArgs from the derived build helper - // functionArgs (adaptArgs { }) - ); + 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 c5adaac76548..4a22ea195a98 100644 --- a/pkgs/applications/editors/emacs/build-support/melpa.nix +++ b/pkgs/applications/editors/emacs/build-support/melpa.nix @@ -5,7 +5,7 @@ let genericBuild = import ./generic.nix { inherit lib stdenv emacs texinfo writeText; }; - libBuildHelper = import ./lib-build-helper.nix { inherit lib; }; + libBuildHelper = import ./lib-build-helper.nix; packageBuild = stdenv.mkDerivation { name = "package-build"; @@ -29,7 +29,7 @@ let in -libBuildHelper.extendMkDerivation { } genericBuild (finalAttrs: +libBuildHelper.extendMkDerivation' genericBuild (finalAttrs: { /* pname: Nix package name without special symbols and without version or diff --git a/pkgs/applications/editors/emacs/build-support/trivial.nix b/pkgs/applications/editors/emacs/build-support/trivial.nix index 71606d463a82..fa3cd2fe5633 100644 --- a/pkgs/applications/editors/emacs/build-support/trivial.nix +++ b/pkgs/applications/editors/emacs/build-support/trivial.nix @@ -3,10 +3,10 @@ { callPackage, lib, ... }@envargs: let - libBuildHelper = import ./lib-build-helper.nix { inherit lib; }; + libBuildHelper = import ./lib-build-helper.nix; in -libBuildHelper.extendMkDerivation { } (callPackage ./generic.nix envargs) (finalAttrs: +libBuildHelper.extendMkDerivation' (callPackage ./generic.nix envargs) (finalAttrs: { pname , version From 5805cf21a8b24491b5d50bb4afb6740bbfe129a8 Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Sun, 4 Aug 2024 09:19:21 +0800 Subject: [PATCH 7/9] emacs: remove unused parameters to make nixf-tidy-review bot happy --- pkgs/applications/editors/emacs/build-support/elpa.nix | 2 -- pkgs/applications/editors/emacs/build-support/generic.nix | 4 +--- pkgs/applications/editors/emacs/build-support/trivial.nix | 6 +----- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/editors/emacs/build-support/elpa.nix b/pkgs/applications/editors/emacs/build-support/elpa.nix index 3e40cd6df56b..48381c4239eb 100644 --- a/pkgs/applications/editors/emacs/build-support/elpa.nix +++ b/pkgs/applications/editors/emacs/build-support/elpa.nix @@ -11,8 +11,6 @@ in libBuildHelper.extendMkDerivation' genericBuild (finalAttrs: { pname -, version -, src , dontUnpack ? true , meta ? {} , ... diff --git a/pkgs/applications/editors/emacs/build-support/generic.nix b/pkgs/applications/editors/emacs/build-support/generic.nix index a3943dda188c..3ff10ee865fb 100644 --- a/pkgs/applications/editors/emacs/build-support/generic.nix +++ b/pkgs/applications/editors/emacs/build-support/generic.nix @@ -25,9 +25,7 @@ in libBuildHelper.extendMkDerivation' stdenv.mkDerivation (finalAttrs: -{ pname -, version -, buildInputs ? [] +{ buildInputs ? [] , nativeBuildInputs ? [] , packageRequires ? [] , propagatedBuildInputs ? [] diff --git a/pkgs/applications/editors/emacs/build-support/trivial.nix b/pkgs/applications/editors/emacs/build-support/trivial.nix index fa3cd2fe5633..2c20b0567c68 100644 --- a/pkgs/applications/editors/emacs/build-support/trivial.nix +++ b/pkgs/applications/editors/emacs/build-support/trivial.nix @@ -8,11 +8,7 @@ in libBuildHelper.extendMkDerivation' (callPackage ./generic.nix envargs) (finalAttrs: -{ pname -, version -, src -, ... -}@args: +args: { buildPhase = args.buildPhase or '' From e64ccec7e762e326a0b8f042762abb5a3b7d53df Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Sun, 4 Aug 2024 09:45:09 +0800 Subject: [PATCH 8/9] emacs: make elpa2nix of elpaBuild consistent with melpaBuild --- pkgs/applications/editors/emacs/build-support/elpa.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/editors/emacs/build-support/elpa.nix b/pkgs/applications/editors/emacs/build-support/elpa.nix index 48381c4239eb..5a8f0ab9e52c 100644 --- a/pkgs/applications/editors/emacs/build-support/elpa.nix +++ b/pkgs/applications/editors/emacs/build-support/elpa.nix @@ -18,12 +18,14 @@ libBuildHelper.extendMkDerivation' genericBuild (finalAttrs: { + elpa2nix = args.elpa2nix or ./elpa2nix.el; + inherit dontUnpack; 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" From bdd77341419276125dbae522fa4a8a16cc895ecf Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Sun, 4 Aug 2024 11:22:47 +0800 Subject: [PATCH 9/9] emacs: inherit files in melpaBuild to make nixf-tidy CI happy --- pkgs/applications/editors/emacs/build-support/melpa.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/editors/emacs/build-support/melpa.nix b/pkgs/applications/editors/emacs/build-support/melpa.nix index 4a22ea195a98..718a0c4d2c1c 100644 --- a/pkgs/applications/editors/emacs/build-support/melpa.nix +++ b/pkgs/applications/editors/emacs/build-support/melpa.nix @@ -66,7 +66,7 @@ libBuildHelper.extendMkDerivation' genericBuild (finalAttrs: */ , recipe ? (writeText "${finalAttrs.pname}-recipe" '' (${finalAttrs.ename} :fetcher git :url "" - ${lib.optionalString (finalAttrs.files or null != null) ":files ${finalAttrs.files}"}) + ${lib.optionalString (finalAttrs.files != null) ":files ${finalAttrs.files}"}) '') , preUnpack ? "" , postUnpack ? "" @@ -79,7 +79,7 @@ libBuildHelper.extendMkDerivation' genericBuild (finalAttrs: elpa2nix = args.elpa2nix or ./elpa2nix.el; melpa2nix = args.melpa2nix or ./melpa2nix.el; - inherit commit ename recipe; + inherit commit ename files recipe; packageBuild = args.packageBuild or packageBuild;