{ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs"; outputs = { self, pre-commit-hooks, nixpkgs, }: let inherit (self) outputs; supportedSystems = ["x86_64-linux" "aarch64-darwin"]; forEachSupportedSystem = nixpkgs.lib.genAttrs supportedSystems; in { formatter = forEachSupportedSystem (system: nixpkgs.legacyPackages.${system}.alejandra); checks = forEachSupportedSystem (system: { pre-commit-check = pre-commit-hooks.lib.${system}.run { src = ./.; hooks = { alejandra.enable = true; }; }; }); devShells = forEachSupportedSystem (system: let pkgs = import nixpkgs {inherit system;}; in { rust-dev = pkgs.mkShell { inherit (outputs.checks.${system}.pre-commit-check) shellHook; buildInputs = with pkgs; [ # nix tools nil alejandra # rust tools cargo rustc rustfmt rustPackages.clippy rust-analyzer # linker clang mold # debugger lldb # libs openssl pkg-config ]; }; default = outputs.devShells.${system}.rust-dev; }); }; }