Files
flake-hub/flake.nix
T
Oleks 727ec77656
ci/woodpecker/push/woodpecker Pipeline failed
Cross-compile s390x packages from x86_64-linux
2026-03-14 00:11:35 +02:00

94 lines
2.3 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
description = "oleks's personal Flake hub a place to publish custom packages and overlays";
inputs = {
fleet-pins.url = "git+https://git.oleks.space/oleks/fleet-pins?ref=main";
nixpkgs.follows = "fleet-pins/nixpkgs-projects";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
fleet-pins,
flake-utils,
...
}:
let
# Systems that have native builders
buildSystems = [
"x86_64-linux"
"aarch64-linux"
];
# Cross-compilation targets from x86_64-linux
crossTargets = {
"s390x-linux" = "s390x-linux";
};
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;
};
}