My system configuration via Nix flakes
# TODO: cargo/rustc should warn if unstable options are no longer valid
# (including when previously unstable behaviour is stabilized)

[unstable]
codegen-backend = true
gc = true
unstable-options = true
no-embed-metadata = true
rustdoc-depinfo = true
rustc-unicode = true

[unstable.git]
shallow_index = true
shallow_deps = true

[unstable.gitoxide]
fetch = true
checkout = true
internal_use_git2 = false

# TODO: if build.rustflags is set here, the rustflags below seem to override them??
# at least for -Zproc-macro-backtrace.
# Cargo should definitely warn about this

[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = [
    # Link using the much faster `wild` linker
    "-C",
    "link-arg=--ld-path=wild",
    # Enable frame pointers for better debugging
    "-C",
    "force-frame-pointers=yes",
    # Enable parallel frontend using all threads
    "-Z",
    "threads=8",
    # Share generics across crates
    "-Z",
    "share-generics",
    # Debug incremental issues
    "-Z",
    "incremental-verify-ich",
    # Macro debugging
    "-Z",
    "macro-backtrace",
    "-Z",
    "proc-macro-backtrace",
    # Terminal URLs
    "-Z",
    "terminal-urls=yes",
]

[profile.dev]
# Use cranelift instead of LLVM for much faster debug codegen
codegen-backend = "cranelift"
# # Split debug info generation
# split-debuginfo = "unpacked"
# Reduce generated debug info
debug = "line-tables-only"

# Front-load optimisations when building dependencies
# This should only hurt clean-build performance as incremental compiles are enabled
[profile.dev.package."*"]
opt-level = 3

[profile.rust-analyzer]
inherits = "dev"

[profile.profiling]
inherits = "release"
debug = true

[cargo-new]
vcs = "pijul"