{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; crane = { url = "github:ipetkov/crane"; inputs.nixpkgs.follows = "nixpkgs"; }; fenix = { url = "github:nix-community/fenix"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { nixpkgs, crane, fenix, ... }: let systems = ["x86_64-linux" "aarch64-linux"]; eachSystem = systems: f: let # Merge together the outputs for all systems. op = attrs: system: let ret = f system; op = attrs: key: attrs // { ${key} = (attrs.${key} or {}) // {${system} = ret.${key};}; }; in builtins.foldl' op attrs (builtins.attrNames ret); in builtins.foldl' op {} systems; forAllSystems = eachSystem systems; in forAllSystems (system: let pkgs = import nixpkgs { inherit system; }; toolchain = with fenix.packages.${system}; combine [ default.rustc default.cargo default.clippy default.rustfmt ]; craneLib = (crane.mkLib pkgs).overrideToolchain toolchain; in rec { packages.default = craneLib.buildPackage { src = pkgs.lib.cleanSourceWith {src = craneLib.path ./.;}; }; apps.default = { drv = packages.default; }; devShells.default = pkgs.mkShell { nativeBuildInputs = [toolchain]; }; }); }