mirror of
https://github.com/logos-messaging/nim-sds.git
synced 2026-01-02 14:13:07 +00:00
Otherwise it fails with: error: aarch64-darwin not supported for Android SDK. Use: NIXPKGS_SYSTEM_OVERRIDE=x86_64-darwin Signed-off-by: Jakub Sokołowski <jakub@status.im>
77 lines
2.0 KiB
Nix
77 lines
2.0 KiB
Nix
{
|
|
description = "Nim-SDS build flake";
|
|
|
|
nixConfig = {
|
|
extra-substituters = [ "https://nix-cache.status.im/" ];
|
|
extra-trusted-public-keys = [ "nix-cache.status.im-1:x/93lOfLU+duPplwMSBR+OlY4+mo+dCN7n0mr4oPwgY=" ];
|
|
};
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs?rev=0ef228213045d2cdb5a169a95d63ded38670b293";
|
|
};
|
|
|
|
outputs = { self, nixpkgs }:
|
|
let
|
|
stableSystems = [
|
|
"x86_64-linux" "aarch64-linux"
|
|
"x86_64-darwin" "aarch64-darwin"
|
|
"x86_64-windows"
|
|
];
|
|
|
|
forAllSystems = f: nixpkgs.lib.genAttrs stableSystems (system: f system);
|
|
|
|
pkgsFor = forAllSystems (
|
|
system: import nixpkgs {
|
|
inherit system;
|
|
config = {
|
|
android_sdk.accept_license = true;
|
|
allowUnfree = true;
|
|
};
|
|
overlays = [
|
|
(final: prev: {
|
|
androidEnvCustom = prev.callPackage ./nix/pkgs/android-sdk { };
|
|
androidPkgs = final.androidEnvCustom.pkgs;
|
|
androidShell = final.androidEnvCustom.shell;
|
|
})
|
|
];
|
|
}
|
|
);
|
|
|
|
in rec {
|
|
packages = forAllSystems (system: let
|
|
pkgs = pkgsFor.${system};
|
|
targets = [
|
|
"libsds-android-arm64"
|
|
"libsds-android-amd64"
|
|
"libsds-android-x86"
|
|
"libsds-android-arm"
|
|
];
|
|
in rec {
|
|
# non-Android package
|
|
libsds = pkgs.callPackage ./nix/default.nix {
|
|
inherit stableSystems;
|
|
src = self;
|
|
targets = [ "libsds" ];
|
|
};
|
|
|
|
default = libsds;
|
|
}
|
|
# Generate a package for each target dynamically
|
|
// builtins.listToAttrs (map (name: {
|
|
inherit name;
|
|
value = pkgs.callPackage ./nix/default.nix {
|
|
inherit stableSystems;
|
|
src = self;
|
|
targets = [ name ];
|
|
};
|
|
}) targets));
|
|
|
|
devShells = forAllSystems (system: let
|
|
pkgs = pkgsFor.${system};
|
|
in {
|
|
default = pkgs.callPackage ./nix/shell.nix { } ;
|
|
});
|
|
};
|
|
|
|
}
|