nix-vcpkg-cross-experiment/flake.nix

69 lines
1.6 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }: let
systems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
"armv7l-linux"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {
vcpkg-tool = final.callPackage ./nix/packages/vcpkg-tool/package.nix { };
vcpkg = import ./nix/packages/vcpkg/package.nix { inherit (prev) vcpkg; };
})
];
};
in f system pkgs);
inherit (nixpkgs) lib;
in {
packages = forAllSystems (system: pkgs: {
default = self.packages.${system}.test;
test = pkgs.callPackage ./nix/packages/test/package.nix {
src = ./.;
};
test-aarch64 = pkgs.pkgsCross.aarch64-multiplatform.callPackage ./nix/packages/test/package.nix {
src = ./.;
};
test-armv7 = pkgs.pkgsCross.armv7l-hf-multiplatform.callPackage ./nix/packages/test/package.nix {
src = ./.;
};
});
devShells = forAllSystems (system: pkgs: {
default = self.devShells.${system}.vcpkgVendoredLibs;
vcpkgVendoredLibs = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
vcpkg
cmake
];
env = {
VCPKG_ROOT = "${pkgs.vcpkg}/share/vcpkg";
};
};
nixVendoredLibs = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
cmake
];
buildInputs = with pkgs; [
nlohmann_json
fmt
];
};
});
};
}