/ flake.nix
flake.nix
1 { 2 description = "Nim-SDS build flake"; 3 4 nixConfig = { 5 extra-substituters = [ "https://nix-cache.status.im/" ]; 6 extra-trusted-public-keys = [ "nix-cache.status.im-1:x/93lOfLU+duPplwMSBR+OlY4+mo+dCN7n0mr4oPwgY=" ]; 7 }; 8 9 inputs = { 10 nixpkgs.url = "github:NixOS/nixpkgs?rev=0ef228213045d2cdb5a169a95d63ded38670b293"; 11 }; 12 13 outputs = { self, nixpkgs }: 14 let 15 stableSystems = [ 16 "x86_64-linux" "aarch64-linux" 17 "x86_64-darwin" "aarch64-darwin" 18 "x86_64-windows" 19 ]; 20 21 forAllSystems = f: nixpkgs.lib.genAttrs stableSystems (system: f system); 22 23 pkgsFor = forAllSystems ( 24 system: import nixpkgs { 25 inherit system; 26 config = { 27 android_sdk.accept_license = true; 28 allowUnfree = true; 29 }; 30 overlays = [ 31 (final: prev: { 32 androidEnvCustom = prev.callPackage ./nix/pkgs/android-sdk { }; 33 androidPkgs = final.androidEnvCustom.pkgs; 34 androidShell = final.androidEnvCustom.shell; 35 }) 36 ]; 37 } 38 ); 39 40 in rec { 41 packages = forAllSystems (system: let 42 pkgs = pkgsFor.${system}; 43 targets = builtins.filter 44 (t: !(pkgs.stdenv.isDarwin && builtins.match "libsds-android.*" t != null)) 45 [ 46 "libsds-android-arm64" 47 "libsds-android-amd64" 48 "libsds-android-x86" 49 "libsds-android-arm" 50 ]; 51 in rec { 52 # non-Android package 53 libsds = pkgs.callPackage ./nix/default.nix { 54 inherit stableSystems; 55 src = self; 56 targets = [ "libsds" ]; 57 }; 58 59 default = libsds; 60 } 61 # Generate a package for each target dynamically 62 // builtins.listToAttrs (map (name: { 63 inherit name; 64 value = pkgs.callPackage ./nix/default.nix { 65 inherit stableSystems; 66 src = self; 67 targets = [ name ]; 68 }; 69 }) targets)); 70 71 devShells = forAllSystems (system: let 72 pkgs = pkgsFor.${system}; 73 in { 74 default = pkgs.callPackage ./nix/shell.nix { } ; 75 }); 76 }; 77 78 }