feat: use mold linker through crane
This commit is contained in:
parent
c37a55d570
commit
b0951b6805
2 changed files with 17 additions and 11 deletions
|
@ -1,2 +0,0 @@
|
|||
[target.x86_64-unknown-linux-gnu]
|
||||
linker = "clang"
|
|
@ -23,28 +23,36 @@
|
|||
};
|
||||
toolchain = fenix.packages.${system}.stable;
|
||||
craneLib = crane.lib.${system}.overrideToolchain toolchain.toolchain;
|
||||
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.stdenv;
|
||||
in
|
||||
{
|
||||
packages.default =
|
||||
packages =
|
||||
let
|
||||
inherit (pkgs.lib) fileset;
|
||||
in
|
||||
craneLib.buildPackage {
|
||||
without = fs: fileset.difference ./. fs;
|
||||
nixFiles = fileset.unions [ ./flake.nix ./flake.lock ./.envrc ];
|
||||
gitFiles = fileset.gitTracked ./.;
|
||||
src = fileset.toSource {
|
||||
root = ./.;
|
||||
fileset = fileset.intersection
|
||||
(fileset.difference ./.
|
||||
(fileset.unions [ ./.cargo ./flake.nix ./flake.lock ./.envrc ]))
|
||||
(fileset.gitTracked ./.);
|
||||
fileset = fileset.intersection (without nixFiles) gitFiles;
|
||||
};
|
||||
in
|
||||
{
|
||||
default =
|
||||
craneLib.buildPackage {
|
||||
inherit src stdenv;
|
||||
};
|
||||
};
|
||||
|
||||
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 a new issue