Skip to content

Commit d438800

Browse files
committed
nix: streamline source filter; move RUSTFLAGS to env attrs
Signed-off-by: NotAShelf <[email protected]> Change-Id: I9761b908d05efd7dc10d53c54ca80fb26a6a6964
1 parent 1d69d31 commit d438800

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

nix/package.nix

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,29 @@
99
inherit (toml) version;
1010
in
1111
rustPlatform.buildRustPackage.override {stdenv = stdenvAdapters.useMoldLinker llvm.stdenv;} {
12-
RUSTFLAGS = "-C link-arg=-fuse-ld=mold";
13-
1412
inherit pname version;
15-
16-
src = builtins.path {
17-
name = "${pname}-${version}";
18-
path = lib.sources.cleanSource ../.;
19-
};
13+
src = let
14+
fs = lib.fileset;
15+
s = ../.;
16+
in
17+
fs.toSource {
18+
root = s;
19+
fileset = fs.unions [
20+
(fs.fileFilter (file: builtins.any file.hasExt ["rs"]) (s + /src))
21+
(s + /Cargo.lock)
22+
(s + /Cargo.toml)
23+
];
24+
};
2025

2126
cargoLock.lockFile = ../Cargo.lock;
2227
enableParallelBuilding = true;
28+
env.RUSTFLAGS = "-C link-arg=-fuse-ld=mold";
2329

2430
meta = {
25-
description = "A microscopic fetch script in Rust, for NixOS systems";
31+
description = "Microscopic fetch script in Rust, for NixOS systems";
2632
homepage = "https://github.com/NotAShelf/microfetch";
2733
license = lib.licenses.gpl3Only;
28-
maintainers = with lib.maintainers; [NotAShelf];
34+
maintainers = [lib.maintainers.NotAShelf];
2935
mainProgram = "microfetch";
3036
};
3137
}

0 commit comments

Comments
 (0)