main
 1{
 2  inputs = {
 3    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
 4
 5    flake-utils.url = "github:numtide/flake-utils";
 6
 7    flake-compat.url = "github:NixOS/flake-compat";
 8
 9    crane.url = "github:ipetkov/crane";
10
11    treefmt-nix = {
12      url = "github:numtide/treefmt-nix";
13      inputs.nixpkgs.follows = "nixpkgs";
14    };
15  };
16
17  outputs = {
18    self,
19    nixpkgs,
20    flake-utils,
21    crane,
22    treefmt-nix,
23    ...
24  }:
25    flake-utils.lib.eachDefaultSystem (system: let
26      pkgs = nixpkgs.legacyPackages.${system};
27
28      craneLib = crane.mkLib pkgs;
29
30      treefmt = (treefmt-nix.lib.evalModule pkgs ./nix/treefmt.nix).config.build;
31    in {
32      formatter = treefmt.wrapper;
33
34      checks.formatting = treefmt.check self;
35
36      packages = {
37        default = pkgs.callPackage ./nix/package.nix {inherit craneLib;};
38      };
39
40      devShells.default = pkgs.mkShell {
41        nativeBuildInputs = with pkgs; [
42          cargo
43          rustc
44
45          rustfmt
46          rust-analyzer
47          taplo
48        ];
49      };
50    });
51}