{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; utils.url = "github:numtide/flake-utils"; naersk = { url = "github:nix-community/naersk"; inputs.nixpkgs.follows = "nixpkgs"; }; # Used for rust compiler rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; }; description = "Rust Toolchain and Utility Flake"; outputs = { self, nixpkgs, utils, ... }@inputs: (utils.lib.eachDefaultSystem (system: { packages = let sources = builtins.fromJSON (builtins.readFile ./sources/sources.json); pkgs = import nixpkgs { inherit system; overlays = [ (import inputs.rust-overlay) ]; }; rust = pkgs.rust-bin.stable.latest.default.override { extensions = [ "llvm-tools-preview" ]; }; naersk-lib = inputs.naersk.lib."${system}".override { rustc = rust; cargo = rust; }; in builtins.mapAttrs (name: source: naersk-lib.buildPackage { pname = source.pname; src = pkgs.fetchCrate source; }) sources; })); }