What is the best way to change just one line of `cmakeFlags` with overlay?

I want to change this line from true to false by overlay:

What is the most easy way / what are the possible ways for this without copying the whole cmakeFlag or even the whole package.nix ? Thanks!

1 Like

I am thinking something like cmakeFlags = prev.cmakeFlags or [] ++ [(cmakeBool "GGML_BACKEND_DL" false)]; but I do not know if it is ok.

Patch that package, use pkgs.applyPatches on nixpkgs.

Eg https://ertt.ca/nix/patch-nixpkgs/

This passes both true and false to cmake, but idk what cmake does then, you can try it out once

1 Like

From Cmake docs:

https://cmake.org/cmake/help/latest/manual/cmake.1.html

It’s important to note that the order of -C and -D arguments is significant. They will be carried out in the order they are listed, with the last argument taking precedence over the previous ones.

So this should work.

2 Likes

Really good to know applyPatches exist, it really blow my mind.
I also tested my proposed overlay method as xokdvium, both compile ok!
but the overlay method make my GPU not found, do not know why
Thank you so much for your help!