From 1501b379e0e5eb29426d24296437daf502b16a6c Mon Sep 17 00:00:00 2001 From: Thomas Zahner Date: Thu, 19 Dec 2024 22:12:18 +0100 Subject: [PATCH] Reuse nixpkgs recipe as suggested by @tirimia --- default.nix | 37 ------------------------------------- flake.nix | 10 ++++++++-- 2 files changed, 8 insertions(+), 39 deletions(-) delete mode 100644 default.nix diff --git a/default.nix b/default.nix deleted file mode 100644 index 2a9a80e..0000000 --- a/default.nix +++ /dev/null @@ -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" - ]; - }; -} diff --git a/flake.nix b/flake.nix index 395924a..02516d2 100644 --- a/flake.nix +++ b/flake.nix @@ -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; + }; + }; } ); };