feat: use mold linker through crane
parent
c37a55d570
commit
b0951b6805
|
@ -1,2 +0,0 @@
|
||||||
[target.x86_64-unknown-linux-gnu]
|
|
||||||
linker = "clang"
|
|
|
@ -23,28 +23,36 @@
|
||||||
};
|
};
|
||||||
toolchain = fenix.packages.${system}.stable;
|
toolchain = fenix.packages.${system}.stable;
|
||||||
craneLib = crane.lib.${system}.overrideToolchain toolchain.toolchain;
|
craneLib = crane.lib.${system}.overrideToolchain toolchain.toolchain;
|
||||||
|
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.stdenv;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages.default =
|
packages =
|
||||||
let
|
let
|
||||||
inherit (pkgs.lib) fileset;
|
inherit (pkgs.lib) fileset;
|
||||||
in
|
without = fs: fileset.difference ./. fs;
|
||||||
craneLib.buildPackage {
|
nixFiles = fileset.unions [ ./flake.nix ./flake.lock ./.envrc ];
|
||||||
|
gitFiles = fileset.gitTracked ./.;
|
||||||
src = fileset.toSource {
|
src = fileset.toSource {
|
||||||
root = ./.;
|
root = ./.;
|
||||||
fileset = fileset.intersection
|
fileset = fileset.intersection (without nixFiles) gitFiles;
|
||||||
(fileset.difference ./.
|
};
|
||||||
(fileset.unions [ ./.cargo ./flake.nix ./flake.lock ./.envrc ]))
|
in
|
||||||
(fileset.gitTracked ./.);
|
{
|
||||||
|
default =
|
||||||
|
craneLib.buildPackage {
|
||||||
|
inherit src stdenv;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
devShell = pkgs.mkShell.override
|
devShell = pkgs.mkShell.override
|
||||||
{
|
{
|
||||||
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenv;
|
inherit stdenv;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
nativeBuildInputs = with toolchain; [ rustc cargo rust-analyzer clippy ];
|
nativeBuildInputs = with toolchain;
|
||||||
|
[ rustc cargo rust-analyzer clippy ] ++ (with pkgs;
|
||||||
|
[ ]
|
||||||
|
);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue