mirror of
https://github.com/NotAShelf/microfetch.git
synced 2026-04-13 13:23:52 +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,
|
lib,
|
||||||
stdenv,
|
|
||||||
stdenvAdapters,
|
|
||||||
rustPlatform,
|
rustPlatform,
|
||||||
llvm,
|
llvm,
|
||||||
useMold ? stdenv.isLinux,
|
|
||||||
}: let
|
}: let
|
||||||
toml = (lib.importTOML ../Cargo.toml).package;
|
toml = (lib.importTOML ../Cargo.toml).package;
|
||||||
pname = toml.name;
|
pname = toml.name;
|
||||||
inherit (toml) version;
|
inherit (toml) version;
|
||||||
|
|
||||||
# Select stdenv based on useMold flag
|
|
||||||
stdenv =
|
|
||||||
if useMold
|
|
||||||
then stdenvAdapters.useMoldLinker llvm.stdenv
|
|
||||||
else llvm.stdenv;
|
|
||||||
in
|
in
|
||||||
rustPlatform.buildRustPackage.override {inherit stdenv;} {
|
rustPlatform.buildRustPackage.override {inherit (llvm) stdenv;} {
|
||||||
inherit pname version;
|
inherit pname version;
|
||||||
src = let
|
src = let
|
||||||
fs = lib.fileset;
|
fs = lib.fileset;
|
||||||
|
|
@ -25,10 +16,11 @@ in
|
||||||
fs.toSource {
|
fs.toSource {
|
||||||
root = s;
|
root = s;
|
||||||
fileset = fs.unions [
|
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.lock)
|
||||||
(s + /Cargo.toml)
|
(s + /Cargo.toml)
|
||||||
(s + /benches)
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -37,12 +29,6 @@ in
|
||||||
buildNoDefaultFeatures = true;
|
buildNoDefaultFeatures = true;
|
||||||
doCheck = false;
|
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 = {
|
meta = {
|
||||||
description = "Microscopic fetch script in Rust, for NixOS systems";
|
description = "Microscopic fetch script in Rust, for NixOS systems";
|
||||||
homepage = "https://github.com/NotAShelf/microfetch";
|
homepage = "https://github.com/NotAShelf/microfetch";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue