Hi,
I’m currently playing around with a derivation for firefox/ librewolf and am currently stuck on adjusting the configureFlags
option:
patched-librewolf-unwrapped = final: prev: {
librewolf-unwrapped = prev.librewolf-unwrapped.overrideAttrs (oldAttrs:
let
# Source: https://firefox-source-docs.mozilla.org/setup/configuring_build_options.html
configureFlags' = with lib.lists; remove "--enable-optimize" (remove "--enable-debug-symbols" oldAttrs.configureFlags);
configureFlags'' = configureFlags' ++ [
"--disable-debug-symbols"
''--enable-optimize="-march=native,-O3"''
"--enable-rust-simd"
];
in
{
makeFlags = oldAttrs.makeFlags ++ [ "-j 12" ];
configureFlags = configureFlags'';
preConfigure = oldAttrs.preConfigure + "RUSTFLAGS=\"-C debuginfo=0 -C target-cpu=native -C opt-level=3\"\n";
});
};
The problem is the ''--enable-optimize="-march=native,-O3"''
line, which translates to "--enable-optimize=\"-march=native,-O3\""
in the nix repl
evaluation & the final derivation. The mozbuild system dislikes this & refuses to compile.
Log of failing build:
$ nix log /nix/store/hhnvs2h6dii3vwwq9w9cgixxkyj8yrgm-librewolf-unwrapped-120.0.1-1.drv
...
configuring
Configuring to generate profiling data
configure flags: --prefix=/nix/store/dllai32s6fy9pxq8bma9wkrk1pn02fhk-librewolf-unwrapped-120.0.1-1 --disable-tests --disable-updater --enable-application=browser --enable-default-toolkit=cairo-gtk3-wayland ... --allow-addon-sideload --disable-debug-symbols --enable-optimize=\"-march=native\,-O3\" --enable-rust-simd ...
Creating global state directory from environment variable: /build/firefox-120.0.1/mozbuild
...
mozbuild.configure.options.InvalidOptionError: --enable-optimize takes 0 or 1 values
I tried to use library functions like builtins.concatStringsSep
but this resulted in the same output strings. There is no other solution to this but removing the escape character.
Does anybody know how to do this/ is this even possible in Nix?