94 lines
2.3 KiB
Nix
94 lines
2.3 KiB
Nix
{
|
||
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;
|
||
};
|
||
}
|