Merge branch 'add-callpackage-infra'

This commit is contained in:
Marcel Müller 2025-03-03 10:55:12 +01:00
commit d2d39773c2
5 changed files with 64 additions and 6 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
.direnv
result

View file

@ -18,13 +18,26 @@
let
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ inputs.rust-overlay.overlays.default ];
overlays = [
inputs.rust-overlay.overlays.default
];
};
lib = import ./lib { inherit inputs; };
rustTarget = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustTarget;
lib = import ./lib {
inherit
inputs
craneLib
pkgs
;
};
in
{
inherit lib;
packages = lib // {
rust = rustTarget;
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = [

View file

@ -1,7 +1,39 @@
{
inputs,
pkgs,
craneLib,
pkg-config,
openssl,
}:
{
let
pname = "cargo-dylint";
version = "4.0.0";
src = pkgs.fetchFromGitHub {
owner = "trailofbits";
repo = "dylint";
tag = "v${version}";
sha256 = "sha256-Z8uuewp7Buoadayc0oTafmfvwNT36KukWKiHxL/mQfI=";
};
in
craneLib.buildPackage {
inherit
pname
version
src
;
buildInputs = [
openssl
];
nativeBuildInputs = [
pkg-config
];
RUSTUP_TOOLCHAIN = "nightly-2025-02-28";
doCheck = false;
}

View file

@ -1,5 +1,15 @@
{
pkgs,
inputs,
craneLib,
...
}:
let
callPackage = pkgs.lib.callPackageWith (pkgs // packages // { inherit inputs craneLib; });
packages = {
cargo-dylint = callPackage ./cargo-dylint.nix { };
};
in
packages

2
rust-toolchain.toml Normal file
View file

@ -0,0 +1,2 @@
[toolchain]
channel = "nightly-2025-03-01"