microfetch/nix/package.nix
NotAShelf 6f8d1ffa83
nix: include benches in source filter; fix build
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Id78ee5f62a5168feef09b5f8713b107c6a6a6964
2025-11-18 00:07:59 +03:00

38 lines
994 B
Nix

{
lib,
rustPlatform,
stdenvAdapters,
llvm,
}: let
toml = (lib.importTOML ../Cargo.toml).package;
pname = toml.name;
inherit (toml) version;
in
rustPlatform.buildRustPackage.override {stdenv = stdenvAdapters.useMoldLinker llvm.stdenv;} {
inherit pname version;
src = let
fs = lib.fileset;
s = ../.;
in
fs.toSource {
root = s;
fileset = fs.unions [
(fs.fileFilter (file: builtins.any file.hasExt ["rs"]) (s + /src))
(s + /Cargo.lock)
(s + /Cargo.toml)
(s + /benches)
];
};
cargoLock.lockFile = ../Cargo.lock;
enableParallelBuilding = true;
env.RUSTFLAGS = "-C link-arg=-fuse-ld=mold";
meta = {
description = "Microscopic fetch script in Rust, for NixOS systems";
homepage = "https://github.com/NotAShelf/microfetch";
license = lib.licenses.gpl3Only;
maintainers = [lib.maintainers.NotAShelf];
mainProgram = "microfetch";
};
}