[feat] use naersk to build package in flake

This commit is contained in:
April John 2024-04-17 18:12:27 +00:00 committed by GitHub
parent 6ec80a7d6d
commit e239863cdb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,6 +5,8 @@
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/default"; systems.url = "github:nix-systems/default";
naersk.url = "github:nix-community/naersk";
# Dev tools # Dev tools
treefmt-nix.url = "github:numtide/treefmt-nix"; treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
@ -23,6 +25,7 @@
libiconv libiconv
openssl openssl
]; ];
naersk' = pkgs.callPackage naersk {};
rust-toolchain = pkgs.symlinkJoin { rust-toolchain = pkgs.symlinkJoin {
name = "rust-toolchain"; name = "rust-toolchain";
paths = [ pkgs.rustc pkgs.cargo pkgs.cargo-watch pkgs.rust-analyzer pkgs.rustPlatform.rustcSrc ]; paths = [ pkgs.rustc pkgs.cargo pkgs.cargo-watch pkgs.rust-analyzer pkgs.rustPlatform.rustcSrc ];
@ -33,10 +36,9 @@
in in
{ {
# Rust package # Rust package
packages.default = pkgs.rustPlatform.buildRustPackage { packages.default = naersk'.buildPackage {
inherit (cargoToml.package) name version; inherit (cargoToml.package) name version;
src = ./.; src = ./.;
cargoLock.lockFile = ./Cargo.lock;
buildInputs = nonRustDeps; buildInputs = nonRustDeps;
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
rust-toolchain rust-toolchain