mirror of
https://github.com/kucherenko/jscpd.git
synced 2026-09-19 08:11:03 +08:00
4ea344b124
The flake pinned the sha256 of channel-rust-1.97.toml, a mutable file that static.rust-lang.org rewrites on every 1.97.x patch release; the 1.97.1 release changed it and broke nix build with a fixed-output hash mismatch. Pin the exact patch version so fenix fetches the immutable channel-rust-1.97.1.toml, and update the hash to match. Fixes #976 Claude-Session: https://claude.ai/code/session_01VvWzWfEK6oV4HTe6EoGkff
86 lines
2.5 KiB
Nix
86 lines
2.5 KiB
Nix
{
|
|
description = "Copy/paste detector — fast Rust-based CLI for code duplication detection";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
|
|
fenix = {
|
|
url = "github:nix-community/fenix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
crane = {
|
|
url = "github:ipetkov/crane";
|
|
};
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, fenix, crane, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
rustToolchain = fenix.packages.${system}.fromToolchainFile {
|
|
file = ./rust/rust-toolchain.toml;
|
|
# Hash of the versioned channel manifest (channel-rust-<x.y.z>.toml);
|
|
# the toolchain file must pin an exact patch version or this drifts.
|
|
sha256 = "sha256-A1abGIbOtcBSdrUMhDGrER3pRM1hQP4fp9gh3Y4PKc8=";
|
|
};
|
|
|
|
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
|
|
|
|
src = pkgs.lib.cleanSourceWith {
|
|
src = ./rust;
|
|
filter = path: type:
|
|
(craneLib.filterCargoSources path type) ||
|
|
(pkgs.lib.hasSuffix ".html" path && pkgs.lib.hasInfix "/templates/" path);
|
|
};
|
|
|
|
commonArgs = {
|
|
inherit src;
|
|
pname = "jscpd";
|
|
version = (craneLib.crateNameFromCargoToml { cargoToml = ./rust/crates/cpd/Cargo.toml; }).version;
|
|
nativeBuildInputs = [ pkgs.pkg-config ];
|
|
buildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [
|
|
pkgs.libiconv
|
|
pkgs.apple-sdk
|
|
];
|
|
};
|
|
|
|
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
|
|
|
jscpd = craneLib.buildPackage (commonArgs // {
|
|
inherit cargoArtifacts;
|
|
doCheck = false;
|
|
meta = {
|
|
description = "Copy/paste detector for programming source code";
|
|
homepage = "https://jscpd.dev";
|
|
license = pkgs.lib.licenses.mit;
|
|
mainProgram = "jscpd";
|
|
};
|
|
});
|
|
in
|
|
{
|
|
packages = {
|
|
inherit jscpd;
|
|
default = jscpd;
|
|
};
|
|
|
|
checks = {
|
|
jscpd-tests = craneLib.cargoNextest (commonArgs // {
|
|
inherit cargoArtifacts;
|
|
cargoExtraArgs = "--lib -p cpd-core -p cpd-tokenizer -p cpd-reporter";
|
|
});
|
|
};
|
|
|
|
devShells.default = craneLib.devShell (commonArgs // {
|
|
packages = with pkgs; [
|
|
cargo-nextest
|
|
cargo-deny
|
|
pkg-config
|
|
];
|
|
});
|
|
}
|
|
);
|
|
} |