From 39a3cf536763604291eac7617db84064d75f7e6f Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Tue, 23 Nov 2021 14:13:10 +0100 Subject: [PATCH 1/2] coreboot-toolchain: Fix building The sub-packages of coreboot-toolchain don't build currently. Fix that by using recurseIntoAttrs. Signed-off-by: Felix Singer --- pkgs/top-level/all-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b0d8b4a6cb61..7401fbbabd7f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12091,7 +12091,7 @@ with pkgs; pscid = nodePackages.pscid; - coreboot-toolchain = callPackages ../development/tools/misc/coreboot-toolchain { }; + coreboot-toolchain = recurseIntoAttrs (callPackage ../development/tools/misc/coreboot-toolchain { }); remarkable-toolchain = callPackage ../development/tools/misc/remarkable/remarkable-toolchain { }; From 3cd5413447d006489000dc20d2be7a758f95f363 Mon Sep 17 00:00:00 2001 From: Andreas Rammhold Date: Wed, 24 Nov 2021 00:15:10 +0100 Subject: [PATCH 2/2] coreboot-toolchain: refactor the package set structure Previously we were unable to override individual attributes within the coreboot-toolchain packageset. By using callPackage on each of the attributes individually we retain the ability to call the override function to inject custom dependencies into the build. --- .../tools/misc/coreboot-toolchain/default.nix | 137 +++++++++--------- 1 file changed, 71 insertions(+), 66 deletions(-) diff --git a/pkgs/development/tools/misc/coreboot-toolchain/default.nix b/pkgs/development/tools/misc/coreboot-toolchain/default.nix index a9d8ab302ea4..d746a6d1ff33 100644 --- a/pkgs/development/tools/misc/coreboot-toolchain/default.nix +++ b/pkgs/development/tools/misc/coreboot-toolchain/default.nix @@ -1,72 +1,77 @@ -{ bison -, callPackage -, curl -, fetchgit -, flex -, getopt -, git -, gnat11 -, lib -, perl -, stdenvNoCC -, zlib -}: - +{ lib, callPackage }: let - common = arch: stdenvNoCC.mkDerivation rec { - pname = "coreboot-toolchain-${arch}"; - version = "4.15"; + common = arch: callPackage ( + { bison + , callPackage + , curl + , fetchgit + , flex + , getopt + , git + , gnat11 + , lib + , perl + , stdenvNoCC + , zlib + }: - src = fetchgit { - url = "https://review.coreboot.org/coreboot"; - rev = version; - sha256 = "1qsb2ca22h5f0iwc254qsfm7qcn8967ir8aybdxa1pakgmnfsyp9"; - fetchSubmodules = false; - leaveDotGit = true; - postFetch = '' - patchShebangs $out/util/crossgcc/buildgcc - PATH=${lib.makeBinPath [ getopt ]}:$PATH $out/util/crossgcc/buildgcc -W > $out/.crossgcc_version - rm -rf $out/.git + stdenvNoCC.mkDerivation rec { + pname = "coreboot-toolchain-${arch}"; + version = "4.15"; + + src = fetchgit { + url = "https://review.coreboot.org/coreboot"; + rev = version; + sha256 = "1qsb2ca22h5f0iwc254qsfm7qcn8967ir8aybdxa1pakgmnfsyp9"; + fetchSubmodules = false; + leaveDotGit = true; + postFetch = '' + patchShebangs $out/util/crossgcc/buildgcc + PATH=${lib.makeBinPath [ getopt ]}:$PATH $out/util/crossgcc/buildgcc -W > $out/.crossgcc_version + rm -rf $out/.git + ''; + }; + + nativeBuildInputs = [ bison curl git perl ]; + buildInputs = [ flex gnat11 zlib ]; + + enableParallelBuilding = true; + dontConfigure = true; + dontInstall = true; + + postPatch = '' + mkdir -p util/crossgcc/tarballs + + ${lib.concatMapStringsSep "\n" ( + file: "ln -s ${file.archive} util/crossgcc/tarballs/${file.name}" + ) (callPackage ./stable.nix { }) + } + + patchShebangs util/genbuild_h/genbuild_h.sh ''; - }; - nativeBuildInputs = [ bison curl git perl ]; - buildInputs = [ flex gnat11 zlib ]; + buildPhase = '' + export CROSSGCC_VERSION=$(cat .crossgcc_version) + make crossgcc-${arch} CPUS=$NIX_BUILD_CORES DEST=$out + ''; - enableParallelBuilding = true; - dontConfigure = true; - dontInstall = true; + meta = with lib; { + homepage = "https://www.coreboot.org"; + description = "coreboot toolchain for ${arch} targets"; + license = with licenses; [ bsd2 bsd3 gpl2 lgpl2Plus gpl3Plus ]; + maintainers = with maintainers; [ felixsinger ]; + platforms = platforms.linux; + }; + } + ); +in - postPatch = '' - mkdir -p util/crossgcc/tarballs - - ${lib.concatMapStringsSep "\n" ( - file: "ln -s ${file.archive} util/crossgcc/tarballs/${file.name}" - ) (callPackage ./stable.nix { }) - } - - patchShebangs util/genbuild_h/genbuild_h.sh - ''; - - buildPhase = '' - export CROSSGCC_VERSION=$(cat .crossgcc_version) - make crossgcc-${arch} CPUS=$NIX_BUILD_CORES DEST=$out - ''; - - meta = with lib; { - homepage = "https://www.coreboot.org"; - description = "coreboot toolchain for ${arch} targets"; - license = with licenses; [ bsd2 bsd3 gpl2 lgpl2Plus gpl3Plus ]; - maintainers = with maintainers; [ felixsinger ]; - platforms = platforms.linux; - }; - }; -in { - i386 = common "i386"; - x86_64 = common "x64"; - arm = common "arm"; - aarch64 = common "aarch64"; - riscv = common "riscv"; - ppc64 = common "ppc64"; - nds32le = common "nds32le"; -} +lib.listToAttrs (map (arch: lib.nameValuePair arch (common arch {})) [ + "i386" + "x64" + "arm" + "aarch64" + "riscv" + "ppc64" + "nds32le" +])