m2dir 2.0.0

Rust implementation of the m2dir specification
Documentation
{
  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;
        overlays = [fenix.overlays.default];
      };

      toolchain = pkgs.fenix.complete.withComponents [
        "cargo"
        "clippy"
        "rust-src"
        "rustc"
        "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 {
        packages = with pkgs; [rust-analyzer-nightly toolchain];
      };
    });
}