Add RISC-V cross-compilation target for CI #195
@ -12,4 +12,9 @@ jobs:
|
|||||||
runs-on: native
|
runs-on: native
|
||||||
steps:
|
steps:
|
||||||
- uses: https://gitea.com/ScMi1/checkout@v1.4
|
- uses: https://gitea.com/ScMi1/checkout@v1.4
|
||||||
- run: nix build -L --no-link --print-out-paths .#bsc-ci.all
|
- run: nix build -L --no-link --print-out-paths .#bsc.ci.all
|
||||||
|
build:cross:
|
||||||
|
runs-on: native
|
||||||
|
steps:
|
||||||
|
- uses: https://gitea.com/ScMi1/checkout@v1.4
|
||||||
|
- run: nix build -L --no-link --print-out-paths .#bsc.ci.cross
|
||||||
|
|||||||
@ -42,9 +42,7 @@ in
|
|||||||
# full nixpkgs with our overlay applied
|
# full nixpkgs with our overlay applied
|
||||||
legacyPackages.${system} = pkgs;
|
legacyPackages.${system} = pkgs;
|
||||||
|
|
||||||
hydraJobs = {
|
hydraJobs = self.legacyPackages.${system}.bsc.hydraJobs;
|
||||||
inherit (self.legacyPackages.${system}.bsc-ci) tests pkgs cross;
|
|
||||||
};
|
|
||||||
|
|
||||||
# propagate nixpkgs lib, so we can do bscpkgs.lib
|
# propagate nixpkgs lib, so we can do bscpkgs.lib
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
|
|||||||
51
overlay.nix
51
overlay.nix
@ -94,12 +94,18 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
pkgs = filterAttrs (_: isDerivation) bscPkgs;
|
# For now, only build toplevel packages in CI/Hydra
|
||||||
|
pkgsTopLevel = filterAttrs (_: isDerivation) bscPkgs;
|
||||||
|
|
||||||
|
rarias marked this conversation as resolved
Outdated
|
|||||||
crossTargets = [ "riscv64" ];
|
# Native build in that platform doesn't imply cross build works
|
||||||
cross = prev.lib.genAttrs crossTargets (target:
|
canCrossCompile = platform: pkg:
|
||||||
final.pkgsCross.${target}.bsc-ci.pkgs
|
(isDerivation pkg) &&
|
||||||
);
|
# Must be defined explicitly
|
||||||
|
(pkg.meta.cross or false) &&
|
||||||
|
(meta.availableOn platform pkg);
|
||||||
|
|
||||||
|
# For now only RISC-V
|
||||||
|
crossSet = { riscv64 = final.pkgsCross.riscv64.bsc.pkgsTopLevel; };
|
||||||
|
|
||||||
buildList = name: paths:
|
buildList = name: paths:
|
||||||
final.runCommandLocal name { } ''
|
final.runCommandLocal name { } ''
|
||||||
@ -113,22 +119,31 @@ let
|
|||||||
printf '%s\n' $deps >$out
|
printf '%s\n' $deps >$out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
crossList = builtins.mapAttrs (t: v: buildList t (builtins.attrValues v)) cross;
|
pkgsList = buildList "ci-pkgs" (builtins.attrValues pkgsTopLevel);
|
||||||
|
testsList = buildList "ci-tests" (collect isDerivation tests);
|
||||||
pkgsList = buildList "ci-pkgs" (builtins.attrValues pkgs);
|
allList = buildList' "ci-all" [ pkgsList testsList ];
|
||||||
testList = buildList "ci-tests" (collect isDerivation tests);
|
# For now only RISC-V
|
||||||
|
crossList = buildList "ci-cross"
|
||||||
all = buildList' "ci-all" [ pkgsList testList ];
|
(filter
|
||||||
|
(canCrossCompile final.pkgsCross.riscv64.stdenv.hostPlatform)
|
||||||
|
(builtins.attrValues crossSet.riscv64));
|
||||||
|
|
||||||
in bscPkgs // {
|
in bscPkgs // {
|
||||||
# Prevent accidental usage of bsc attribute
|
# Prevent accidental usage of bsc-ci attribute
|
||||||
bsc = throw "the bsc attribute is deprecated, packages are now in the root";
|
bsc-ci = throw "the bsc-ci attribute is deprecated, use bsc.ci";
|
||||||
|
|
||||||
# Internal for our CI tests
|
# Internal for our CI tests
|
||||||
bsc-ci = {
|
bsc = {
|
||||||
inherit pkgs pkgsList;
|
# CI targets for nix build
|
||||||
inherit tests testList;
|
ci = { pkgs = pkgsList; tests = testsList; all = allList; cross = crossList; };
|
||||||
inherit cross crossList;
|
|
||||||
inherit all;
|
# Direct access to package sets
|
||||||
|
tests = tests;
|
||||||
|
rarias marked this conversation as resolved
Outdated
abonerib
commented
I think building intelPackages should be fine, but callPackage adding override messes things up. `inherit pkgs;` would fix the set building non top-level derivations, but maybe we want to do something else?
I think building intelPackages should be fine, but callPackage adding override messes things up.
rarias
commented
I think building derivations in intelPackages would be a good thing. But we only want to build the amd driver, not every package in linuxPackages. Not sure if recurseForDerivations could help here. Otherwise, leaving it only for top-level packages would be ok for now. I think building derivations in intelPackages would be a good thing. But we only want to build the amd driver, not every package in linuxPackages. Not sure if recurseForDerivations could help here.
Otherwise, leaving it only for top-level packages would be ok for now.
rarias
commented
Leaving it for top-level only. Leaving it for top-level only.
|
|||||||
|
pkgs = bscPkgs;
|
||||||
|
pkgsTopLevel = pkgsTopLevel;
|
||||||
|
cross = crossSet;
|
||||||
|
|
||||||
|
# Hydra uses attribute sets of pkgs
|
||||||
|
hydraJobs = { tests = tests; pkgs = pkgsTopLevel; cross = crossSet; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,4 +55,7 @@ in
|
|||||||
doCheck = true;
|
doCheck = true;
|
||||||
checkTarget = "test";
|
checkTarget = "test";
|
||||||
hardeningDisable = [ "all" ];
|
hardeningDisable = [ "all" ];
|
||||||
|
meta = {
|
||||||
|
cross = true;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user
So,
meta.cross = trueis for packages that cross compile, and we know they are correct (tested to be working), right?I think for now I would keep the meaning to just: "This package will be added to the
bsc.ci.crosstarget". The precise meaning is whatever we currently have set inbsc.ci.cross, so we could add future architectures there without touching the packages. Banning a package from cross-compilation to a future arch can be controlled withmeta.badPlatforms.In particular, it would mean that the package builds, not neccesarily that it was further tested.