nix: setup sccache
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I375e0d41d42939b63a01a59d41b3fd426a6a6964
This commit is contained in:
parent
cee172fcc3
commit
422e21aaf1
1 changed files with 35 additions and 12 deletions
|
|
@ -26,18 +26,6 @@ in
|
||||||
name = "pinakes-dev";
|
name = "pinakes-dev";
|
||||||
packages =
|
packages =
|
||||||
[
|
[
|
||||||
pkgs.taplo # TOML formatter
|
|
||||||
pkgs.lldb # debugger
|
|
||||||
pkgs.llvm
|
|
||||||
|
|
||||||
# Modern, LLVM based linking pipelime
|
|
||||||
llvmPackages.lld
|
|
||||||
llvmPackages.clang
|
|
||||||
|
|
||||||
# Additional Cargo Tooling
|
|
||||||
pkgs.cargo-nextest
|
|
||||||
pkgs.cargo-deny
|
|
||||||
|
|
||||||
# Build tools
|
# Build tools
|
||||||
# We use the rust-overlay to get the stable Rust toolchain for various targets.
|
# We use the rust-overlay to get the stable Rust toolchain for various targets.
|
||||||
# This is not exactly necessary, but it allows for compiling for various targets
|
# This is not exactly necessary, but it allows for compiling for various targets
|
||||||
|
|
@ -47,11 +35,43 @@ in
|
||||||
targets = ["wasm32-unknown-unknown" "wasm32-wasip1"]; # web + plugins
|
targets = ["wasm32-unknown-unknown" "wasm32-wasip1"]; # web + plugins
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# Modern, LLVM based linking pipeline
|
||||||
|
llvmPackages.lld
|
||||||
|
llvmPackages.clang
|
||||||
|
|
||||||
# Handy CLI for packaging Dioxus apps and such
|
# Handy CLI for packaging Dioxus apps and such
|
||||||
pkgs.dioxus-cli
|
pkgs.dioxus-cli
|
||||||
|
|
||||||
|
# Additional Cargo Tooling
|
||||||
|
pkgs.cargo-nextest
|
||||||
|
pkgs.cargo-deny
|
||||||
|
|
||||||
|
# Other tools
|
||||||
|
pkgs.taplo # TOML formatter
|
||||||
|
pkgs.lldb # debugger
|
||||||
|
pkgs.sccache # distributed Rust cache
|
||||||
]
|
]
|
||||||
++ runtimeDeps;
|
++ runtimeDeps;
|
||||||
|
|
||||||
|
# We could do this in the NixOS configuration via ~/.config/cargo.toml
|
||||||
|
# or something, but this is better because it lets everyone benefit
|
||||||
|
# from sccache while working with Pinakes. The reason those variables
|
||||||
|
# are not in 'env' are that we have to use Bash, which doesn't mix well
|
||||||
|
# with Nix strings.
|
||||||
|
shellHook = ''
|
||||||
|
if [ -n "$SCCACHE_BIN" ]; then
|
||||||
|
export RUSTC_WRAPPER="$SCCACHE_BIN"
|
||||||
|
export SCCACHE_DIR="''${HOME}/.cache/sccache"
|
||||||
|
export SCCACHE_CACHE_SIZE="50G"
|
||||||
|
mkdir -p "$SCCACHE_DIR"
|
||||||
|
|
||||||
|
echo "sccache setup complete!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start the daemon early for slightly faster startup.
|
||||||
|
"$SCCACHE_BIN" --start-server >/dev/null 2>&1 || true
|
||||||
|
'';
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
# Allow Cargo to use lld and clang properly
|
# Allow Cargo to use lld and clang properly
|
||||||
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
||||||
|
|
@ -64,5 +84,8 @@ in
|
||||||
|
|
||||||
# Runtime library path for GTK/WebKit/xdotool
|
# Runtime library path for GTK/WebKit/xdotool
|
||||||
LD_LIBRARY_PATH = "${lib.makeLibraryPath runtimeDeps}";
|
LD_LIBRARY_PATH = "${lib.makeLibraryPath runtimeDeps}";
|
||||||
|
|
||||||
|
# Enable sccache for local nix develop shell
|
||||||
|
SCCACHE_BIN = "${pkgs.sccache}/bin/sccache";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue