From 2b5062b3a21c8ac42c8ec2cdf9994a1e3bc6177e Mon Sep 17 00:00:00 2001 From: Mathis Date: Fri, 23 Aug 2024 18:12:25 +0200 Subject: [PATCH] Fix pre-commit hooks (#252) - Remove python project - Remove license header precommit hooks - Update flake.lock - Run cargo-sort --- Cargo.toml | 4 +- flake.lock | 132 ++++------------------------------------------------- flake.nix | 39 +--------------- 3 files changed, 13 insertions(+), 162 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d3a3b437..3cd340b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,10 +18,12 @@ clap = { version = "4.5", features = ["derive", "env"] } committable = "0.2" derivative = "2.2" futures = "0.3" +hex = "0.4.3" hotshot = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.71" } hotshot-builder-api = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.71" } hotshot-events-service = { git = "https://github.com/EspressoSystems/hotshot-events-service.git", tag = "0.1.42" } hotshot-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.71" } +lru = "0.12.3" serde = { version = "1.0", features = ["derive"] } sha2 = "0.10" snafu = "0.8" @@ -31,8 +33,6 @@ tide-disco = "0.9" tokio = "1" tracing = "0.1" vbs = "0.1" -lru = "0.12.3" -hex = "0.4.3" [dev-dependencies] hotshot-example-types = { git = "https://github.com/EspressoSystems/HotShot.git", tag = "0.5.71" } diff --git a/flake.lock b/flake.lock index 866f94df..a7f1b8e4 100644 --- a/flake.lock +++ b/flake.lock @@ -50,24 +50,6 @@ "type": "github" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -89,34 +71,13 @@ "type": "github" } }, - "nix-github-actions": { - "inputs": { - "nixpkgs": [ - "poetry2nixFlake", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1703863825, - "narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=", - "owner": "nix-community", - "repo": "nix-github-actions", - "rev": "5163432afc817cf8bd1f031418d1869e4c9d5547", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nix-github-actions", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1722062969, - "narHash": "sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg=", + "lastModified": 1724224976, + "narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b73c2221a46c13557b1b3be9c2070cc42cf01eb3", + "rev": "c374d94f1536013ca8e92341b540eba4c22f9c62", "type": "github" }, "original": { @@ -158,30 +119,6 @@ "type": "github" } }, - "poetry2nixFlake": { - "inputs": { - "flake-utils": "flake-utils_2", - "nix-github-actions": "nix-github-actions", - "nixpkgs": [ - "nixpkgs" - ], - "systems": "systems_3", - "treefmt-nix": "treefmt-nix" - }, - "locked": { - "lastModified": 1721039874, - "narHash": "sha256-XANsG9GYHip8pxZpbqKf/YGv8tIa0xTh289Y+WNBNfw=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "d11c01e58587e5f21037ed6477465a7f26a32e27", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "poetry2nix", - "type": "github" - } - }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat_2", @@ -192,11 +129,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1721042469, - "narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=", + "lastModified": 1724227338, + "narHash": "sha256-TuSaYdhOxeaaE9885mFO1lZHHax33GD5A9dczJrGUjw=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "f451c19376071a90d8c58ab1a953c6e9840527fd", + "rev": "6cedaa7c1b4f82a266e5d30f212273e60d62cb0d", "type": "github" }, "original": { @@ -210,7 +147,6 @@ "flake-compat": "flake-compat", "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", - "poetry2nixFlake": "poetry2nixFlake", "pre-commit-hooks": "pre-commit-hooks", "rust-overlay": "rust-overlay" } @@ -220,11 +156,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1722046723, - "narHash": "sha256-G7/gHz8ORRvHd1/RIURrdcswKRPe9K0FsIYR4v5jSWo=", + "lastModified": 1724379657, + "narHash": "sha256-+CFDh1FUgyY7q0FiWhKJpHS7LlD3KbiqN5Z4Z+4bGmc=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "56baac5e6b2743d4730e664ea64f6d8a2aad0fbb", + "rev": "a18034322c7703fcfe5d7352a77981ba4a936a61", "type": "github" }, "original": { @@ -247,56 +183,6 @@ "repo": "default", "type": "github" } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "id": "systems", - "type": "indirect" - } - }, - "treefmt-nix": { - "inputs": { - "nixpkgs": [ - "poetry2nixFlake", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1719749022, - "narHash": "sha256-ddPKHcqaKCIFSFc/cvxS14goUhCOAwsM1PbMr0ZtHMg=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "8df5ff62195d4e67e2264df0b7f5e8c9995fd0bd", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index a15bf921..9b9df509 100644 --- a/flake.nix +++ b/flake.nix @@ -26,17 +26,11 @@ inputs.pre-commit-hooks.inputs.flake-utils.follows = "flake-utils"; inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs"; - inputs.poetry2nixFlake = { - url = "github:nix-community/poetry2nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - outputs = { self, nixpkgs, flake-utils, rust-overlay, pre-commit-hooks, poetry2nixFlake, ... }: + outputs = { self, nixpkgs, flake-utils, rust-overlay, pre-commit-hooks, ... }: flake-utils.lib.eachDefaultSystem (system: let overlays = [ (import rust-overlay) ]; pkgs = import nixpkgs { inherit system overlays; }; - poetry2nix = poetry2nixFlake.lib.mkPoetry2Nix { inherit pkgs; }; rustToolchain = pkgs.rust-bin.stable.latest.minimal.override { extensions = [ "rustfmt" "clippy" "llvm-tools-preview" "rust-src" ]; }; @@ -96,8 +90,6 @@ license = with licenses; [ mit asl20 ]; }; }; - pythonEnv = poetry2nix.mkPoetryEnv { projectDir = ./.; }; - myPython = with pkgs; [ poetry pythonEnv ]; shellHook = '' # Prevent cargo aliases from using programs in `~/.cargo` to avoid conflicts with rustup # installations. @@ -132,33 +124,6 @@ entry = "cargo clippy --workspace --all-features --all-targets -- -D clippy::dbg-macro"; pass_filenames = false; }; - license-header-c-style = { - enable = true; - description = - "Ensure files with c-style comments have license header"; - entry = '' - insert_license --license-filepath .license-header.txt --comment-style "//"''; - types_or = [ "rust" ]; - pass_filenames = true; - }; - license-header-hash = { - enable = true; - description = - "Ensure files with hash style comments have license header"; - entry = '' - insert_license --license-filepath .license-header.txt --comment-style "#"''; - types_or = [ "bash" "python" "toml" "nix" ]; - excludes = [ "poetry.lock" ]; - pass_filenames = true; - }; - license-header-html = { - enable = true; - description = "Ensure markdown files have license header"; - entry = '' - insert_license --license-filepath .license-header.txt --comment-style ""''; - types_or = [ "markdown" ]; - pass_filenames = true; - }; }; }; }; @@ -175,7 +140,7 @@ mdbook # make-doc, documentation generation protobuf rustToolchain - ] ++ myPython ++ rustDeps; + ] ++ rustDeps; inherit RUST_SRC_PATH RUST_BACKTRACE RUST_LOG RUSTFLAGS; };