mirror of
https://github.com/NotAShelf/microfetch.git
synced 2026-04-12 21:07:41 +00:00
nix: use mold on all Linux targets; fix source filters
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ib5925097dd366505d01f9448e7e2ee926a6a6964
This commit is contained in:
parent
d6977bafe5
commit
5ce0f3b1e8
1 changed files with 4 additions and 18 deletions
|
|
@ -1,22 +1,13 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
stdenvAdapters,
|
||||
rustPlatform,
|
||||
llvm,
|
||||
useMold ? stdenv.isLinux,
|
||||
}: let
|
||||
toml = (lib.importTOML ../Cargo.toml).package;
|
||||
pname = toml.name;
|
||||
inherit (toml) version;
|
||||
|
||||
# Select stdenv based on useMold flag
|
||||
stdenv =
|
||||
if useMold
|
||||
then stdenvAdapters.useMoldLinker llvm.stdenv
|
||||
else llvm.stdenv;
|
||||
in
|
||||
rustPlatform.buildRustPackage.override {inherit stdenv;} {
|
||||
rustPlatform.buildRustPackage.override {inherit (llvm) stdenv;} {
|
||||
inherit pname version;
|
||||
src = let
|
||||
fs = lib.fileset;
|
||||
|
|
@ -25,10 +16,11 @@ in
|
|||
fs.toSource {
|
||||
root = s;
|
||||
fileset = fs.unions [
|
||||
(fs.fileFilter (file: builtins.any file.hasExt ["rs"]) (s + /src))
|
||||
(fs.fileFilter (file: builtins.any file.hasExt ["rs"]) (s + /crates))
|
||||
(fs.fileFilter (file: builtins.any file.hasExt ["rs"]) (s + /microfetch))
|
||||
(s + /.cargo)
|
||||
(s + /Cargo.lock)
|
||||
(s + /Cargo.toml)
|
||||
(s + /benches)
|
||||
];
|
||||
};
|
||||
|
||||
|
|
@ -37,12 +29,6 @@ in
|
|||
buildNoDefaultFeatures = true;
|
||||
doCheck = false;
|
||||
|
||||
# Only set RUSTFLAGS for mold if useMold is enabled
|
||||
env = lib.optionalAttrs useMold {
|
||||
CARGO_LINKER = "clang";
|
||||
RUSTFLAGS = "-C link-arg=-fuse-ld=mold";
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Microscopic fetch script in Rust, for NixOS systems";
|
||||
homepage = "https://github.com/NotAShelf/microfetch";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue