Cross-compile s390x packages from x86_64-linux
This commit is contained in:
@@ -22,34 +22,78 @@
|
||||
"s390x-linux"
|
||||
];
|
||||
in
|
||||
flake-utils.lib.eachSystem supportedSystems (
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in
|
||||
{
|
||||
packages = rec {
|
||||
hello-world = pkgs.callPackage ./packages/hello-world.nix { };
|
||||
xonsh = pkgs.callPackage ./packages/xonsh.nix { };
|
||||
default = hello-world;
|
||||
};
|
||||
let
|
||||
# Systems that have native builders
|
||||
buildSystems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
|
||||
overlays.default = final: prev: {
|
||||
hello-world = final.callPackage ./packages/hello-world.nix { };
|
||||
xonsh = final.callPackage ./packages/xonsh.nix { };
|
||||
};
|
||||
# Cross-compilation targets from x86_64-linux
|
||||
crossTargets = {
|
||||
"s390x-linux" = "s390x-linux";
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
name = "oleks-hub-shell";
|
||||
buildInputs = [ self.packages.${system}.default ];
|
||||
nativeBuildInputs = with pkgs; [
|
||||
nix
|
||||
fmt
|
||||
];
|
||||
shellHook = ''
|
||||
echo "Welcome to the oleks Flake hub development shell."
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
mkPackages = pkgs: {
|
||||
hello-world = pkgs.callPackage ./packages/hello-world.nix { };
|
||||
xonsh = pkgs.callPackage ./packages/xonsh.nix { };
|
||||
};
|
||||
|
||||
# Native builds
|
||||
native = flake-utils.lib.eachSystem buildSystems (
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
packages = mkPackages pkgs;
|
||||
in
|
||||
{
|
||||
packages = packages // {
|
||||
default = packages.hello-world;
|
||||
};
|
||||
|
||||
overlays.default = final: prev: mkPackages final;
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
name = "oleks-hub-shell";
|
||||
buildInputs = [ self.packages.${system}.default ];
|
||||
nativeBuildInputs = with pkgs; [
|
||||
nix
|
||||
fmt
|
||||
];
|
||||
shellHook = ''
|
||||
echo "Welcome to the oleks Flake hub development shell."
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
# Cross-compiled builds (built from x86_64-linux)
|
||||
cross = builtins.listToAttrs (
|
||||
builtins.map (
|
||||
target:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
system = "x86_64-linux";
|
||||
crossSystem.config = nixpkgs.lib.systems.examples.${
|
||||
{
|
||||
"s390x-linux" = "s390x";
|
||||
}
|
||||
.${target}
|
||||
}.config;
|
||||
};
|
||||
packages = mkPackages pkgs;
|
||||
in
|
||||
{
|
||||
name = target;
|
||||
value = packages // {
|
||||
default = packages.hello-world;
|
||||
};
|
||||
}
|
||||
) (builtins.attrNames crossTargets)
|
||||
);
|
||||
in
|
||||
native
|
||||
// {
|
||||
packages = (native.packages or { }) // cross;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user