Reuse nixpkgs recipe as suggested by @tirimia

This commit is contained in:
Thomas Zahner 2024-12-19 22:12:18 +01:00
parent 38645a1c1c
commit 1501b379e0
2 changed files with 8 additions and 39 deletions

View file

@ -1,37 +0,0 @@
{ pkgs }:
let
version =
let
cargoToml = builtins.readFile ./Cargo.toml;
match = builtins.match ''.*version = "([^"]+)".*'' cargoToml;
in
if match != null then builtins.elemAt match 0 else throw "Version not found in Cargo.toml";
in
{
app = pkgs.rustPlatform.buildRustPackage {
pname = "lychee";
inherit version;
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs =
[ pkgs.openssl ]
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
pkgs.Security
pkgs.SystemConfiguration
];
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
RUST_BACKTRACE = 1;
checkFlags = [
"--skip=src/lib.rs"
"--skip=client::tests"
"--skip=collector::tests::test_url_without_extension_is_html"
];
};
}

View file

@ -9,6 +9,7 @@
{
nixpkgs,
rust-overlay,
self,
...
}:
let
@ -51,10 +52,15 @@
system:
let
pkgs = nixpkgs.legacyPackages.${system};
code = import ./default.nix { inherit pkgs; };
in
{
default = code.app;
default = pkgs.lychee.overrideAttrs {
src = ./.;
version = self.rev or self.dirtyShortRev;
cargoDeps = pkgs.rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
};
};
}
);
};