Не удалось пересобрать coreutils с переопределениями с Nix - PullRequest
0 голосов
/ 09 ноября 2019

Как обсуждалось в этом вопросе , переопределение атрибутов дериваций, которые необходимы для самого Nix, сложнее, чем обычно.

Я пытался использовать код, приведенный в примере, и столкнулсябольше проблем. Вот мой ~/.config/nixpkgs/overlays/main.nix:

_: super:
let coreutils = super.coreutils.override { aclSupport = false; };
in
{
  stdenv = super.stdenv // {
    overrides = self2: super2:
      super.stdenv.overrides self2 super2 // {
        inherit coreutils;
    };
  };
}

Теперь, когда я пытаюсь установить свою версию coreutils с nix-env -iA nixpkgs.coreutils --show-trace, я получаю следующую ошибку:

replacing old 'coreutils-8.31'
installing 'coreutils-8.31'
error: while evaluating the attribute 'buildInputs' of the derivation 'coreutils-8.31' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:191:11:
while evaluating the attribute 'builder' of the derivation 'gmp-6.1.2' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/development/libraries/gmp/6.x.nix:9:3:
while evaluating the attribute 'shell' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/stdenv/generic/default.nix:103:14:
while evaluating the attribute 'gcc' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/stdenv/linux/default.nix:290:7:
while evaluating 'makeOverridable' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/lib/customisation.nix:67:24, called from /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/stdenv/linux/default.nix:290:13:
while evaluating anonymous function at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/build-support/cc-wrapper/default.nix:8:1, called from /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/lib/customisation.nix:69:16:
while evaluating the attribute 'gcc-unwrapped' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/stdenv/linux/default.nix:258:7:
while evaluating the attribute 'gcc-unwrapped.override' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/top-level/all-packages.nix:7666:3:
while evaluating 'addMetaAttrs' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/lib/meta.nix:15:28, called from /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/top-level/all-packages.nix:7825:10:
while evaluating 'wrapCC' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/top-level/all-packages.nix:8688:12, called from /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/top-level/all-packages.nix:7825:19:
while evaluating 'wrapCCWith' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/top-level/all-packages.nix:8667:5, called from /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/top-level/all-packages.nix:8688:16:
while evaluating 'callPackageWith' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/lib/customisation.nix:117:35, called from /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/top-level/all-packages.nix:8676:7:
while evaluating 'makeOverridable' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/lib/customisation.nix:67:24, called from /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/lib/customisation.nix:121:8:
while evaluating anonymous function at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/build-support/cc-wrapper/default.nix:8:1, called from /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/lib/customisation.nix:69:16:
while evaluating the attribute 'cc.nativeTools' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/stdenv/generic/default.nix:148:14:
while evaluating 'makeOverridable' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/lib/customisation.nix:67:24, called from /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/stdenv/linux/default.nix:101:19:
while evaluating anonymous function at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/build-support/cc-wrapper/default.nix:8:1, called from /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/lib/customisation.nix:69:16:
while evaluating the attribute 'buildInputs' of the derivation 'glibc-2.27' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/development/libraries/glibc/common.nix:167:3:
while evaluating the attribute 'depsBuildBuild' of the derivation 'linux-headers-4.19.16' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:191:11:
while evaluating the attribute 'bintools' of the derivation 'bootstrap-stage2-gcc-wrapper' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/build-support/cc-wrapper/default.nix:96:3:
while evaluating the attribute 'bintools_bin' of the derivation 'binutils-wrapper-2.31.1' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix:76:3:
while evaluating the attribute 'buildInputs' of the derivation 'binutils-2.31.1' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/development/tools/misc/binutils/default.nix:26:3:
while evaluating the attribute 'stdenv' of the derivation 'zlib-1.2.11' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/development/libraries/zlib/default.nix:18:3:
while evaluating the attribute 'defaultNativeBuildInputs' of the derivation 'bootstrap-stage1-stdenv-linux' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/stdenv/generic/default.nix:73:14:
while evaluating the attribute 'bintools' of the derivation 'bootstrap-stage1-gcc-wrapper' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/build-support/cc-wrapper/default.nix:96:3:
while evaluating the attribute 'coreutils_bin' of the derivation 'bootstrap-stage0-binutils-wrapper' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix:76:3:
while evaluating the attribute 'buildInputs' of the derivation 'coreutils-8.31' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:191:11:
while evaluating the attribute 'nativeBuildInputs' of the derivation 'attr-2.4.48' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/development/libraries/attr/default.nix:4:3:
while evaluating the attribute 'nativeBuildInputs' of the derivation 'gettext-0.19.8.1' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:191:11:
while evaluating the attribute 'nativeBuildInputs' of the derivation 'bison-3.4.2' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:191:11:
while evaluating the attribute 'postInstall' of the derivation 'perl-5.30.0' at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/development/interpreters/perl/default.nix:29:5:
cannot coerce null to a string, at /nix/store/dmdqvlxfk7c5gj4jg8iv77d8bmyk3c12-nixpkgs-20.03pre199995.895874d2145/nixpkgs/pkgs/development/interpreters/perl/default.nix:128:7

Я не понимаю, чтопроисходит, это нулевое принуждение происходит где-то в postInstall. Хорошо, я тоже пытаюсь переопределить perl:

_: super:
let coreutils = super.coreutils.override { aclSupport = false; };
in
{
  stdenv = super.stdenv // {
    overrides = self2: super2:
      super.stdenv.overrides self2 super2 // {
        inherit coreutils;
        perl = super.perl.overrideAttrs (_: { postInstall = ""; });
    };
  };
}

Теперь попытка установить coreutils вызывает перестроение perl (конечно), что завершается ошибкой из-за отсутствия компилятора C:

./UU/checkcc: line 10: cc: command not found

И вот я застрял. Итак, как переопределить coreutils?

...