From 4a257755460272f8a2287c7afdcd4f332a9c44fb Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 13 Jul 2022 04:39:12 +0300 Subject: [PATCH 1/9] lua-packages: fix eval failure when cross-compiling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit remove the inherit line did not work fixes mpv for example nix-repl> pkgsCross.aarch64-multiplatform.lua.withPackages (ps: with ps; [ luasocket ]) error: attribute 'runtimeShell' missing at /home/artturin/nixgits/my-nixpkgs/pkgs/top-level/all-packages.nix:849:17: 848| substitutions = { 849| shell = targetPackages.runtimeShell; | ^ 850| passthru.tests = tests.makeWrapper; … while evaluating the attribute 'shell' of the derivation 'hook' at /home/artturin/nixgits/my-nixpkgs/pkgs/stdenv/generic/make-derivation.nix:270:7: 269| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 270| name = | ^ 271| let … while evaluating 'optionalString' at /home/artturin/nixgits/my-nixpkgs/lib/strings.nix:203:5: 202| # String to return if condition is true 203| string: if cond then string else ""; | ^ 204| … from call site at /home/artturin/nixgits/my-nixpkgs/pkgs/build-support/trivial-builders.nix:536:12: 535| cp ${script} $out/nix-support/setup-hook 536| '' + lib.optionalString (deps != []) '' | ^ 537| printWords ${toString deps} > $out/nix-support/propagated-build-inputs … while evaluating the attribute 'buildCommand' of the derivation 'hook' at /home/artturin/nixgits/my-nixpkgs/pkgs/stdenv/generic/make-derivation.nix:270:7: 269| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 270| name = | ^ 271| let … while evaluating anonymous lambda at /home/artturin/nixgits/my-nixpkgs/lib/lists.nix:646:25: 645| */ 646| unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) []; | ^ 647| … from call site at /home/artturin/nixgits/my-nixpkgs/pkgs/development/interpreters/lua-5/build-lua-package.nix:105:27: 104| # example externalDeps': [ { name = "CRYPTO"; dep = pkgs.openssl; } ] 105| externalDepsGenerated = lib.unique (lib.filter (drv: !drv ? luaModule) ( | ^ 106| luarocksDrv.nativeBuildInputs ++ luarocksDrv.propagatedBuildInputs ++ luarocksDrv.buildInputs) … while evaluating 'generateLuarocksConfig' at /home/artturin/nixgits/my-nixpkgs/pkgs/development/lua-modules/lib.nix:83:28: 82| */ 83| generateLuarocksConfig = { | ^ 84| externalDeps … from call site at /home/artturin/nixgits/my-nixpkgs/pkgs/development/interpreters/lua-5/build-lua-package.nix:85:23: 84| luarocks_content = let 85| generatedConfig = lua.pkgs.lib.generateLuarocksConfig { | ^ 86| externalDeps = externalDeps ++ externalDepsGenerated; … while evaluating the attribute 'configurePhase' of the derivation 'lua5.2-luasocket-3.0.0-1-aarch64-unknown-linux-gnu' at /home/artturin/nixgits/my-nixpkgs/pkgs/stdenv/generic/make-derivation.nix:270:7: 269| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 270| name = | ^ 271| let … while evaluating anonymous lambda at /home/artturin/nixgits/my-nixpkgs/lib/lists.nix:646:25: 645| */ 646| unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) []; | ^ 647| … from call site at /home/artturin/nixgits/my-nixpkgs/pkgs/development/lua-modules/lib.nix:5:6: 4| modules = filter hasLuaModule drvs; 5| in unique ([lua] ++ modules ++ concatLists (catAttrs "requiredLuaModules" modules)); | ^ 6| # Check whether a derivation provides a lua module. … while evaluating 'requiredLuaModules' at /home/artturin/nixgits/my-nixpkgs/pkgs/development/lua-modules/lib.nix:3:24: 2| let 3| requiredLuaModules = drvs: with lib; let | ^ 4| modules = filter hasLuaModule drvs; … from call site at /home/artturin/nixgits/my-nixpkgs/pkgs/development/interpreters/lua-5/wrapper.nix:13:14: 12| env = let 13| paths = requiredLuaModules (extraLibs ++ [ lua ] ); | ^ 14| in buildEnv { … while evaluating the attribute 'passAsFile' at /home/artturin/nixgits/my-nixpkgs/pkgs/build-support/buildenv/default.nix:77:5: 76| # XXX: The size is somewhat arbitrary 77| passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ]; | ^ 78| } … while evaluating the attribute 'passAsFile' of the derivation 'lua-aarch64-unknown-linux-gnu-5.2.4-env' at /home/artturin/nixgits/my-nixpkgs/pkgs/stdenv/generic/make-derivation.nix:270:7: 269| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 270| name = | ^ 271| let --- pkgs/top-level/lua-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix index cb963bb1b177..53e534811bfc 100644 --- a/pkgs/top-level/lua-packages.nix +++ b/pkgs/top-level/lua-packages.nix @@ -60,7 +60,7 @@ in # wraps programs in $out/bin with valid LUA_PATH/LUA_CPATH wrapLua = callPackage ../development/interpreters/lua-5/wrap-lua.nix { inherit lua lib; - inherit (pkgs) makeSetupHook makeWrapper; + inherit (pkgs.buildPackages) makeSetupHook makeWrapper; }; luarocks = callPackage ../development/tools/misc/luarocks/default.nix { From 99a52394e9a5f4a1993609d826292a935ab64a5f Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 13 Jul 2022 16:55:04 +0300 Subject: [PATCH 2/9] mpv: move makeWrapper to nativeBuildInputs to fix cross eval error: attribute 'runtimeShell' missing --- pkgs/applications/video/mpv/wrapper.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/video/mpv/wrapper.nix b/pkgs/applications/video/mpv/wrapper.nix index 3dfe83e2449e..e9be744ed01c 100644 --- a/pkgs/applications/video/mpv/wrapper.nix +++ b/pkgs/applications/video/mpv/wrapper.nix @@ -64,7 +64,7 @@ let # TODO: don't link all mpv outputs and convert package to mpv-unwrapped? paths = [ mpv.all ]; - buildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeWrapper ]; passthru.unwrapped = mpv; From 9e53565bfee17014fe19a3124c59e7f9d184aa65 Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 13 Jul 2022 17:28:54 +0300 Subject: [PATCH 3/9] python310Packages.mutagen: fix cross python3.10-mutagen> /nix/store/wfkwbqp5bvipx7inf3rm4xzk2402w82i-stdenv-linux/setup: line 86: /nix/store/hq5f9z5vnss8h5zy62p0m93550wswsp8-python3-aarch64-unknown-linux-gnu-3.10.5/bin/python3: cannot execute binary file: Exec format error --- pkgs/development/python-modules/mutagen/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/mutagen/default.nix b/pkgs/development/python-modules/mutagen/default.nix index b5415c51c4cd..f0bd0951d816 100644 --- a/pkgs/development/python-modules/mutagen/default.nix +++ b/pkgs/development/python-modules/mutagen/default.nix @@ -33,7 +33,7 @@ buildPythonPackage rec { ]; postInstall = '' - ${python.interpreter} setup.py build_sphinx --build-dir=$doc + ${python.pythonForBuild.interpreter} setup.py build_sphinx --build-dir=$doc ''; checkInputs = [ From a42a1cbc19d6d54fe392bb66a31b642449021eb9 Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 13 Jul 2022 18:37:56 +0300 Subject: [PATCH 4/9] luarocks: fix cross-compiling splicing is not currently working for luaPackages TODO: fix splicing that luarocks-aarch64-unknown-linux-gnu> /nix/store/wfkwbqp5bvipx7inf3rm4xzk2402w82i-stdenv-linux/setup: line 87: /nix/store/vbv8x2awfaa7y3fnxlpbc jh99q31qr3j-lua-aarch64-unknown-linux-gnu-5.2.4/bin/lua: cannot execute binary file: Exec format error --- pkgs/development/tools/misc/luarocks/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/misc/luarocks/default.nix b/pkgs/development/tools/misc/luarocks/default.nix index 70df08af2de0..4e486e9d24fd 100644 --- a/pkgs/development/tools/misc/luarocks/default.nix +++ b/pkgs/development/tools/misc/luarocks/default.nix @@ -1,4 +1,5 @@ {lib, stdenv, fetchFromGitHub +, buildPackages , curl, makeWrapper, which, unzip , lua # for 'luarocks pack' @@ -43,7 +44,7 @@ stdenv.mkDerivation rec { fi ''; - nativeBuildInputs = [ makeWrapper installShellFiles ]; + nativeBuildInputs = [ makeWrapper installShellFiles buildPackages.lua ]; buildInputs = [ lua curl which ]; @@ -63,7 +64,7 @@ stdenv.mkDerivation rec { installShellCompletion --cmd luarocks --zsh <($out/bin/luarocks completion zsh) ''; - propagatedBuildInputs = [ zip unzip cmake ]; + propagatedNativeBuildInputs = [ zip unzip cmake ]; # unpack hook for src.rock and rockspec files setupHook = ./setup-hook.sh; From 271665ec4c38636b19ae40079f48256407883d1b Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 13 Jul 2022 21:03:30 +0300 Subject: [PATCH 5/9] bundlerApp: put makeWrapper in nativeBuildInputs fixes cross 'error: attribute 'runtimeShell' missing' --- pkgs/development/ruby-modules/bundler-app/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/ruby-modules/bundler-app/default.nix b/pkgs/development/ruby-modules/bundler-app/default.nix index e3c430cc923b..1e6a934e3cb8 100644 --- a/pkgs/development/ruby-modules/bundler-app/default.nix +++ b/pkgs/development/ruby-modules/bundler-app/default.nix @@ -27,6 +27,7 @@ , allowSubstitutes ? false , installManpages ? true , meta ? {} +, nativeBuildInputs ? [] , buildInputs ? [] , postBuild ? "" , gemConfig ? null @@ -39,7 +40,7 @@ let cmdArgs = removeAttrs args [ "pname" "postBuild" "gemConfig" "passthru" "gemset" "gemdir" ] // { inherit preferLocalBuild allowSubstitutes; # pass the defaults - buildInputs = buildInputs ++ lib.optional (scripts != []) makeWrapper; + nativeBuildInputs = nativeBuildInputs ++ lib.optionals (scripts != []) [ makeWrapper ]; meta = { platforms = ruby.meta.platforms; } // meta; passthru = basicEnv.passthru // { From c87635d9178354c4743ace7398632d661685c9fe Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 13 Jul 2022 20:52:50 +0300 Subject: [PATCH 6/9] doc: move makeWrapper to nativeBuildInputs from buildInputs makeWrapper in buildInputs breaks cross-compilation with error: attribute 'runtimeShell' missing --- doc/languages-frameworks/maven.section.md | 6 ++++-- doc/languages-frameworks/ruby.section.md | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/languages-frameworks/maven.section.md b/doc/languages-frameworks/maven.section.md index f53a6fa8ac22..cc5b4e3ed799 100644 --- a/doc/languages-frameworks/maven.section.md +++ b/doc/languages-frameworks/maven.section.md @@ -233,7 +233,8 @@ in stdenv.mkDerivation rec { src = builtins.fetchTarball "https://github.com/fzakaria/nixos-maven-example/archive/main.tar.gz"; - buildInputs = [ maven makeWrapper ]; + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ maven ]; buildPhase = '' echo "Using repository ${repository}" @@ -310,7 +311,8 @@ in stdenv.mkDerivation rec { src = builtins.fetchTarball "https://github.com/fzakaria/nixos-maven-example/archive/main.tar.gz"; - buildInputs = [ maven makeWrapper ]; + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ maven ]; buildPhase = '' echo "Using repository ${repository}" diff --git a/doc/languages-frameworks/ruby.section.md b/doc/languages-frameworks/ruby.section.md index e29f97c566c1..d1265097d206 100644 --- a/doc/languages-frameworks/ruby.section.md +++ b/doc/languages-frameworks/ruby.section.md @@ -274,7 +274,7 @@ bundlerApp { gemdir = ./.; exes = [ "r10k" ]; - buildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeWrapper ]; postBuild = '' wrapProgram $out/bin/r10k --prefix PATH : ${lib.makeBinPath [ git gnutar gzip ]} From 6a249036fb7d4546d7ab482589d06d14da7480e3 Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 13 Jul 2022 21:41:20 +0300 Subject: [PATCH 7/9] gnustep.gsmakeDerivation: fix cross eval error: attribute 'runtimeShell' missing --- pkgs/desktops/gnustep/make/gsmakeDerivation.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/desktops/gnustep/make/gsmakeDerivation.nix b/pkgs/desktops/gnustep/make/gsmakeDerivation.nix index eff7f3eac85a..11aa53b77b5c 100644 --- a/pkgs/desktops/gnustep/make/gsmakeDerivation.nix +++ b/pkgs/desktops/gnustep/make/gsmakeDerivation.nix @@ -1,7 +1,7 @@ { lib, stdenv, make, makeWrapper, which }: -{ buildInputs ? [], ...} @ args: +{ nativeBuildInputs ? [], ...} @ args: stdenv.mkDerivation (args // { - buildInputs = [ makeWrapper make which ] ++ buildInputs; + nativeBuildInputs = [ makeWrapper make which ] ++ nativeBuildInputs; builder = ./builder.sh; setupHook = ./setup-hook.sh; From 7db9cda1b5e0038b7a5c93ec7d058fb6318a82fe Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 13 Jul 2022 22:12:10 +0300 Subject: [PATCH 8/9] gnustep.make: fix cross --- pkgs/desktops/gnustep/make/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/desktops/gnustep/make/default.nix b/pkgs/desktops/gnustep/make/default.nix index ce2c1f2f144b..def8e297b552 100644 --- a/pkgs/desktops/gnustep/make/default.nix +++ b/pkgs/desktops/gnustep/make/default.nix @@ -22,7 +22,9 @@ stdenv.mkDerivation rec { "GNUSTEP_INSTALLATION_DOMAIN=SYSTEM" ]; - buildInputs = [ clang which libobjc ]; + nativeBuildInputs = [ clang which ]; + buildInputs = [ libobjc ]; + patches = [ ./fixup-paths.patch ]; setupHook = ./setup-hook.sh; meta = { From 4a53aba96852f06d26e47d43c1a3ac9852c0a2ed Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 15 Jul 2022 01:58:11 +0300 Subject: [PATCH 9/9] Revert "luarocks: fix cross-compiling" it introduces the wrong lua version and the output will depend on it to fix splicing the lua infra has to be reworked This reverts commit a42a1cbc19d6d54fe392bb66a31b642449021eb9. --- pkgs/development/tools/misc/luarocks/default.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/development/tools/misc/luarocks/default.nix b/pkgs/development/tools/misc/luarocks/default.nix index 4e486e9d24fd..70df08af2de0 100644 --- a/pkgs/development/tools/misc/luarocks/default.nix +++ b/pkgs/development/tools/misc/luarocks/default.nix @@ -1,5 +1,4 @@ {lib, stdenv, fetchFromGitHub -, buildPackages , curl, makeWrapper, which, unzip , lua # for 'luarocks pack' @@ -44,7 +43,7 @@ stdenv.mkDerivation rec { fi ''; - nativeBuildInputs = [ makeWrapper installShellFiles buildPackages.lua ]; + nativeBuildInputs = [ makeWrapper installShellFiles ]; buildInputs = [ lua curl which ]; @@ -64,7 +63,7 @@ stdenv.mkDerivation rec { installShellCompletion --cmd luarocks --zsh <($out/bin/luarocks completion zsh) ''; - propagatedNativeBuildInputs = [ zip unzip cmake ]; + propagatedBuildInputs = [ zip unzip cmake ]; # unpack hook for src.rock and rockspec files setupHook = ./setup-hook.sh;