From 05e39da57e0eb5012f62121bf3aee17f77847578 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 3 Mar 2025 10:24:46 +0100 Subject: [PATCH] WIP: Package cargo-dylint --- flake.nix | 4 ++++ lib/cargo-dylint.nix | 24 ++++++++++++++++++++++-- rust-toolchain.toml | 2 ++ 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/flake.nix b/flake.nix index 8e8138d..925ca26 100644 --- a/flake.nix +++ b/flake.nix @@ -26,11 +26,15 @@ ]; }; + rustTarget = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustTarget; + callPackage = pkgs.lib.callPackageWith ( pkgs // { inherit inputs + craneLib ; } ); diff --git a/lib/cargo-dylint.nix b/lib/cargo-dylint.nix index 66d991a..ab8cefe 100644 --- a/lib/cargo-dylint.nix +++ b/lib/cargo-dylint.nix @@ -1,8 +1,28 @@ { - inputs, + pkgs, + craneLib, ... }: -{ +let + pname = "cargo-dylint"; + version = "4.0.0"; + src = pkgs.fetchFromGitHub { + owner = "trailofbits"; + repo = "dylint"; + tag = "v${version}"; + sha256 = "sha256-Z8uuewp7Buoadayc0oTafmfvwNT36KukWKiHxL/mQfI="; + }; + + cargoArtifacts = craneLib.buildDepsOnly { + inherit pname version src; + }; +in craneLib.buildPackage { + inherit + cargoArtifacts + pname + version + src + ; } diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..168d4fd --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "nightly-2025-03-01"