Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvmPackages.*: Add devExtraCmakeFlags parameter #342040

Merged
merged 1 commit into from
Sep 22, 2024

Commits on Sep 15, 2024

  1. llvmPackages.*: Add devExtraCmakeFlags parameter

    cmake flags have a 'last flag wins' logic, so by appending to the end of
    the flags it is possible to override any cmake flag.
    
    It also ignores (and warns) if a flag is unused, so passing flags across
    all packages should be safe if you want to target one package.
    
    In combination with NixOS#320261, this PR allows consistently overriding all
    packages within LLVM with additional cmake arguments. Consistency here
    means for example 'if you override LLVM, then all dependencies on it are
    also see the overridden LLVM in their input'. Consistency is hard to
    achieve with the other obvious way of implementing this as a user: if
    you use overrideAttrs then you have to write a big mess of override code
    in order to override all dependents, and this can be very difficult in a
    cross-compilation scenario using crossSystem and useLLVM, for example.
    
    With this PR it is possible to write an overlay which overlays
    `llvmPackages` with `llvmPackage.override { devExtraCmakeFlags = [ ... ]; }`,
    and then the toolchain used with useLLVM in effect should respect
    these flags.
    
    This is useful in development for experimenting with the effect of
    various flags, hence the chosen name `devCmakeFlags`.
    
    This won't work out of the box without NixOS#341855 applied, which fixes
    override passthrough.
    
    See-Also: NixOS#320261, NixOS#341855
    Signed-off-by: Peter Waller <[email protected]>
    pwaller committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    290ec4e View commit details
    Browse the repository at this point in the history