From 58a32702852fbaceac080f5952574290cac432f8 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 15 Jul 2024 14:05:13 -0400 Subject: [PATCH 1/4] sarif-fmt: 0.4.2 -> 0.5.0 Diff: https://github.com/psastras/sarif-rs/compare/sarif-fmt-v0.4.2...sarif-fmt-v0.5.0 --- pkgs/by-name/sa/sarif-fmt/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/sa/sarif-fmt/package.nix b/pkgs/by-name/sa/sarif-fmt/package.nix index ad273bca0d64..455e8b105f6d 100644 --- a/pkgs/by-name/sa/sarif-fmt/package.nix +++ b/pkgs/by-name/sa/sarif-fmt/package.nix @@ -9,16 +9,16 @@ }: rustPlatform.buildRustPackage rec { pname = "sarif-fmt"; - version = "0.4.2"; + version = "0.5.0"; src = fetchFromGitHub { owner = "psastras"; repo = "sarif-rs"; rev = "sarif-fmt-v${version}"; - hash = "sha256-EzWzDeIeSJ11CVcVyAhMjYQJcKHnieRrFkULc5eXAno="; + hash = "sha256-RnoJfmkrqdhOioGkB7rTzHQ3kx9vIRfWDJN30/8JAvM="; }; - cargoHash = "sha256-dHOxVLXtnqSHMX5r1wFxqogDf9QdnOZOjTyYFahru34="; + cargoHash = "sha256-VonkXSeyp8Kxo5mE+eI5ialgqcCFvDALv/XXl2i8DZ0="; cargoBuildFlags = [ "--package" "sarif-fmt" From f06ed2b167df8f14cc2bc169063077fe6a09625c Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 15 Jul 2024 14:35:32 -0400 Subject: [PATCH 2/4] sarif-fmt: fetchFromGitHub -> fetchCrate this makes things much easier to build as we don't need to account for the monorepo --- pkgs/by-name/sa/sarif-fmt/package.nix | 30 ++++++++------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/pkgs/by-name/sa/sarif-fmt/package.nix b/pkgs/by-name/sa/sarif-fmt/package.nix index 455e8b105f6d..ae9082e546da 100644 --- a/pkgs/by-name/sa/sarif-fmt/package.nix +++ b/pkgs/by-name/sa/sarif-fmt/package.nix @@ -1,9 +1,8 @@ { lib, stdenv, - fetchFromGitHub, + fetchCrate, rustPlatform, - clippy, sarif-fmt, testers, }: @@ -11,37 +10,26 @@ rustPlatform.buildRustPackage rec { pname = "sarif-fmt"; version = "0.5.0"; - src = fetchFromGitHub { - owner = "psastras"; - repo = "sarif-rs"; - rev = "sarif-fmt-v${version}"; - hash = "sha256-RnoJfmkrqdhOioGkB7rTzHQ3kx9vIRfWDJN30/8JAvM="; + src = fetchCrate { + inherit pname version; + hash = "sha256-QiIAo9q8pcon/Os7ih8jJyDLvKPrLD70LkMAQfgwDNM="; }; - cargoHash = "sha256-VonkXSeyp8Kxo5mE+eI5ialgqcCFvDALv/XXl2i8DZ0="; - cargoBuildFlags = [ - "--package" - "sarif-fmt" - ]; - cargoTestFlags = cargoBuildFlags; + cargoHash = "sha256-RlINf/8P+OpZffvqbkKoafeolioDGABWS71kpGcX/cs="; # `test_clippy` (the only test we enable) is broken on Darwin # because `--enable-profiler` is not enabled in rustc on Darwin # error[E0463]: can't find crate for profiler_builtins doCheck = !stdenv.isDarwin; - nativeCheckInputs = [ - # `test_clippy` - clippy - ]; - checkFlags = [ - # this test uses nix so...no go + # these tests use nix so...no go "--skip=test_clang_tidy" - # ditto "--skip=test_hadolint" - # ditto "--skip=test_shellcheck" + + # requires files not present in the crates.io tarball + "--skip=test_clipp" ]; passthru = { From 870b2353d28380be990ac2a4395c7010ed0f947b Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 15 Jul 2024 14:36:11 -0400 Subject: [PATCH 3/4] sarif-fmt: add updateScript --- pkgs/by-name/sa/sarif-fmt/package.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/by-name/sa/sarif-fmt/package.nix b/pkgs/by-name/sa/sarif-fmt/package.nix index ae9082e546da..78e0ac9c058f 100644 --- a/pkgs/by-name/sa/sarif-fmt/package.nix +++ b/pkgs/by-name/sa/sarif-fmt/package.nix @@ -3,6 +3,7 @@ stdenv, fetchCrate, rustPlatform, + nix-update-script, sarif-fmt, testers, }: @@ -34,6 +35,7 @@ rustPlatform.buildRustPackage rec { passthru = { tests.version = testers.testVersion { package = sarif-fmt; }; + updateScript = nix-update-script { }; }; meta = { From f3d6c633b452c02de29019a93f3c28dff6de2b4d Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 15 Jul 2024 14:37:28 -0400 Subject: [PATCH 4/4] sarif-fmt: testers.testVersion -> versionCheckHook this results in less ugly recursion --- pkgs/by-name/sa/sarif-fmt/package.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/sa/sarif-fmt/package.nix b/pkgs/by-name/sa/sarif-fmt/package.nix index 78e0ac9c058f..aa61af8f1375 100644 --- a/pkgs/by-name/sa/sarif-fmt/package.nix +++ b/pkgs/by-name/sa/sarif-fmt/package.nix @@ -4,8 +4,7 @@ fetchCrate, rustPlatform, nix-update-script, - sarif-fmt, - testers, + versionCheckHook, }: rustPlatform.buildRustPackage rec { pname = "sarif-fmt"; @@ -33,8 +32,10 @@ rustPlatform.buildRustPackage rec { "--skip=test_clipp" ]; + nativeInstallCheckInputs = [ versionCheckHook ]; + doInstallCheck = true; + passthru = { - tests.version = testers.testVersion { package = sarif-fmt; }; updateScript = nix-update-script { }; };