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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user