{ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nur-xin = { url = "git+https://git.xinyang.life/xin/nur"; inputs.nixpkgs.follows = "nixpkgs"; }; flake-utils.url = "github:numtide/flake-utils"; pre-commit-hooks = { url = "github:cachix/pre-commit-hooks.nix"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, ... }@inputs: with inputs; flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; } // nur-xin.packages.${system}; in { checks = { pre-commit-check = pre-commit-hooks.lib.${system}.run { src = ./.; hooks = { trim-trailing-whitespace.enable = true; clang-format = { enable = true; types_or = pkgs.lib.mkForce [ "c" "c++" ]; }; nil.enable = true; nixpkgs-fmt.enable = true; }; }; }; devShells.default = (pkgs.mkShell.override { stdenv = pkgs.ccacheStdenv; }) { inherit (self.checks.${system}.pre-commit-check) shellHook; nativeBuildInputs = self.checks.${system}.pre-commit-check.enabledPackages; packages = with pkgs; [ (pkgs.spike.overrideAttrs (self: super: { pname = super.pname + "-rv32e"; src = pkgs.fetchFromGitHub { owner = "riscv-software-src"; repo = "riscv-isa-sim"; rev = "2890ea72125b69eb96bb0458a5bbc00ce26e8872"; hash = "sha256-gCtTmq4GhxoZit8fqJT0+E4XJiltM2ArlmLkEyJ68vk="; }; patches = [ ]; configureFlags = [ "--with-isa=RV32E" "--enable-optional-subprojects" ]; check = false; doInstallCheck = false; })) mini-gdbstub cmake pkg-config ninja gdb ]; }; } ); }