-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathflake.nix
61 lines (59 loc) · 2.26 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Flake Shell for building release artifacts for swift and kotlin
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
fenix = {
url = "github:nix-community/fenix";
inputs = { nixpkgs.follows = "nixpkgs"; };
};
flake-parts = { url = "github:hercules-ci/flake-parts"; };
systems.url = "github:nix-systems/default";
mkshell-util.url = "github:insipx/mkShell-util.nix";
crane = {
url = "github:ipetkov/crane";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
};
nixConfig = {
extra-trusted-public-keys = "xmtp.cachix.org-1:nFPFrqLQ9kjYQKiWL7gKq6llcNEeaV4iI+Ka1F+Tmq0=";
extra-substituters = "https://xmtp.cachix.org";
};
outputs = inputs@{ flake-parts, fenix, crane, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = import inputs.systems;
perSystem = { pkgs, system, ... }:
let
util = import inputs.mkshell-util;
mkShellWrappers = pkgs: util callPackage pkgs;
callPackage = pkgs: pkgs.lib.callPackageWith ((mkShellWrappers pkgs) // pkgs);
pkgConfig = {
inherit system;
# Rust Overlay
overlays = [ fenix.overlays.default ];
config = {
android_sdk.accept_license = true;
allowUnfree = true;
};
};
craneLib = crane.mkLib pkgs;
filesets = pkgs.callPackage ./nix/filesets.nix { inherit craneLib; };
in
{
_module.args.pkgs = import inputs.nixpkgs pkgConfig;
devShells = {
# shell for general xmtp rust dev
default = callPackage pkgs ./nix/libxmtp.nix { };
# Shell for android builds
android = callPackage pkgs ./nix/android.nix { };
# Shell for iOS builds
ios = callPackage pkgs ./nix/ios.nix { };
js = callPackage pkgs ./nix/js.nix { };
# the environment bindings_wasm is built in
wasmBuild = (callPackage pkgs ./nix/package/bindings_wasm.nix { inherit filesets; craneLib = crane.mkLib pkgs; }).devShell;
};
packages.bindings_wasm = (pkgs.callPackage ./nix/package/bindings_wasm.nix { inherit filesets; craneLib = crane.mkLib pkgs; }).bin;
};
};
}