diff options
author | figsoda | 2023-01-21 11:21:40 -0500 |
---|---|---|
committer | figsoda | 2023-01-21 11:26:21 -0500 |
commit | 63ff217996b7d470905bbdcac256e144fbf6700d (patch) | |
tree | 3e17f6bad8bfaec5f9442066c54a4c4c8a881fbf /pkgs | |
parent | 9f05e44db61e90f44b2831f051dd53c5e014ae3c (diff) |
nixpkgs-hammering: init at unstable-2022-11-15
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/tools/nix/nixpkgs-hammering/default.nix | 63 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
2 files changed, 65 insertions, 0 deletions
diff --git a/pkgs/tools/nix/nixpkgs-hammering/default.nix b/pkgs/tools/nix/nixpkgs-hammering/default.nix new file mode 100644 index 000000000000..8cec4597d30b --- /dev/null +++ b/pkgs/tools/nix/nixpkgs-hammering/default.nix @@ -0,0 +1,63 @@ +{ lib +, fetchFromGitHub +, rustPlatform +, stdenv +, makeWrapper +, python3 +, nix +}: + +let + version = "unstable-2022-11-15"; + + src = fetchFromGitHub { + owner = "jtojnar"; + repo = "nixpkgs-hammering"; + rev = "1b038ef38fececb39b65a4cdfa7273ed9d9359b4"; + hash = "sha256-5wZGGTahP1Tlu+WAgGx8Q9YnnHtyhfScl9j6X3W+Toc="; + }; + + meta = with lib; { + description = "A set of nit-picky rules that aim to point out and explain common mistakes in nixpkgs package pull requests"; + homepage = "https://github.com/jtojnar/nixpkgs-hammering"; + license = licenses.mit; + maintainers = with maintainers; [ figsoda ]; + }; + + rust-checks = rustPlatform.buildRustPackage { + pname = "nixpkgs-hammering-rust-checks"; + inherit version src meta; + sourceRoot = "${src.name}/rust-checks"; + cargoHash = "sha256-YiC9mts6h15ZGdLKKmCVNNdTWDPtbDF0J5pwtjc6YKM="; + }; +in + +stdenv.mkDerivation { + pname = "nixpkgs-hammering"; + + inherit version src; + + nativeBuildInputs = [ makeWrapper ]; + + buildInputs = [ python3 ]; + + installPhase = '' + runHook preInstall + + AST_CHECK_NAMES=$(find ${rust-checks}/bin -maxdepth 1 -type f -printf "%f:") + + install -Dt $out/bin tools/nixpkgs-hammer + wrapProgram $out/bin/nixpkgs-hammer \ + --prefix PATH : ${lib.makeBinPath [ nix rust-checks ]} \ + --set AST_CHECK_NAMES ''${AST_CHECK_NAMES%:} + + cp -r lib overlays $out + + runHook postInstall + ''; + + meta = meta // { + mainProgram = "nixpkgs-hammer"; + }; +} + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1df342fa13dd..93f48f592a76 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -37554,6 +37554,8 @@ with pkgs; nixpkgs-fmt = callPackage ../tools/nix/nixpkgs-fmt { }; + nixpkgs-hammering = callPackage ../tools/nix/nixpkgs-hammering { }; + rnix-hashes = callPackage ../tools/nix/rnix-hashes { }; nixos-artwork = callPackage ../data/misc/nixos-artwork { }; |