I want to pass multiple flags to configure inside a string like this:
--with-spral-lflags="-lspral -lgfortran -lhwloc -lm -lcoinmetis -lopenblas -lstdc++ -fopenmp"
but if I add it to configureFlags as
''--with-spral-lflags="-lspral -lgfortran -lhwloc -lm -lcoinmetis -lopenblas -lstdc++ -fopenmp"''
or by using " and escaping it it results in
--with-spral-lflags=\"-lspral -lgfortran -lhwloc -lm -lcoinmetis -lopenblas -lstdc++ -fopenmp\"
Is there a way to prevent this, or is there a better way to achieve this?
In my config files I escape those characters with ''
a double single quote.
TLATER
3
There are two different escape sequences in nix, depending on which type of string you use: Data Types - Nix Reference Manual
You’re currently using the wrong escape for ''
.
That said, you shouldn’t need to escape "
in a ''
string. If you end up with spurious backslashes something else is wrong.
1 Like
NobbZ
4
You probably have to use configFlagsArray
. It is mentioned at Nixpkgs 23.11 manual | Nix & NixOS.
The similar makeFlagsArray
has a usage example at Nixpkgs 23.11 manual | Nix & NixOS
You need of course to stay within preConfigure
or “earlier”.
4 Likes
That’s what I was missing, ty!
I knew I was missing something, but as searched for the wrong keyword.
It looks like this now for me:
preConfigure = ''
configureFlagsArray+=(
"--with-spral-lflags=-lspral -lgfortran -lhwloc -lm -lmetis -lopenblas -lstdc++ -fopenmp"
)
'';