Skip to content

wrapFirefox: make makeWrapperArgs overridable#374270

Merged
mweinelt merged 2 commits intoNixOS:masterfrom
ShamrockLee:firefox-wrapper-makeWrapperArgs
Jan 17, 2025
Merged

wrapFirefox: make makeWrapperArgs overridable#374270
mweinelt merged 2 commits intoNixOS:masterfrom
ShamrockLee:firefox-wrapper-makeWrapperArgs

Conversation

@ShamrockLee
Copy link
Contributor

@ShamrockLee ShamrockLee commented Jan 16, 2025

This PR allows changing the wrapper's makeWrapperArgs via overrideAttrs utilizing __structuredAttrs = true and mkDerivation's fixed-point arguments support.

Example use case:

firefox.overrideAttrs (
  previousAttrs:
  {
    makeWrapperArgs = previousAttrs.makeWrapperArgs ++ [
      "--set-default"
      "MOZ_USE_XINPUT2"
      "1"
    ];
  })

I preserved the overriding behaviour of the libs and gtk_modules for compatibility purposes.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@nix-owners nix-owners bot requested a review from mweinelt January 16, 2025 10:06
@ShamrockLee
Copy link
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 374270


x86_64-linux

❌ 1 package failed to build:
  • midori
✅ 20 packages built:
  • dropbox
  • dropbox-cli
  • dropbox-cli.nautilusExtension
  • eyewitness
  • firefox
  • firefox-beta
  • firefox-beta-bin
  • firefox-bin
  • firefox-devedition
  • firefox-devedition-bin
  • firefox-esr
  • firefox-mobile
  • floorp
  • librewolf
  • mate.caja-dropbox
  • sitespeed-io
  • thunderbird (thunderbird-128 ,thunderbird-esr)
  • thunderbird-bin
  • thunderbird-latest
  • vimb

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Jan 16, 2025

midori and midori-unwrapped alreadp fail to build on master (#374354). The build failure is not a regression of this PR.

@ShamrockLee ShamrockLee changed the title firefox: wrapper: make makeWrapperArgs overridable wrapFirefox: make makeWrapperArgs overridable Jan 16, 2025
@mweinelt mweinelt merged commit 9d42721 into NixOS:master Jan 17, 2025
56 of 58 checks passed

] ++ lib.optionals (!hasMozSystemDirPatch) (lib.concatMap (ext: [
"--run"
''ln -sfLt ''${MOZ_HOME:-~/.mozilla}/native-messaging-hosts ${ext}/lib/mozilla/native-messaging-hosts/*''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the --run above does not correctly escape/quote the command to run. If there are any native messaging hosts, the build of the wrapper fails:

error: builder for '/nix/store/dk194z1a1q94z56wir1y45gg1q09h5ch-librewolf-134.0.1-1.drv' failed with exit code 1;
       last 9 log lines:
       > structuredAttrs is enabled
       >
       > Builder called die: makeWrapper doesn't understand the arg -p
       > Backtrace:
       > 185 makeShellWrapper /nix/store/9cdcy8k4zp8zm03kpqf49xghfk1c451l-make-shell-wrapper-hook/nix-support/setup-hook
       > 37 makeWrapper /nix/store/9cdcy8k4zp8zm03kpqf49xghfk1c451l-make-shell-wrapper-hook/nix-support/setup-hook
       > 1818 genericBuild /nix/store/d0gfdcag8bxzvg7ww4s7px4lf8sxisyx-stdenv-linux/setup
       > 4 main /nix/store/v6x3cs394jgqfbi0a42pam708flxaphh-default-builder.sh
       >
       For full logs, run 'nix log /nix/store/dk194z1a1q94z56wir1y45gg1q09h5ch-librewolf-134.0.1-1.drv'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I located the error. It's not the specification of the makeWrapperArgs elements (which I checked carefully to ensure evaluation equivalence), but I forgot to quote the Bash array ${makeWrapperArgs[@]}. Sorry for the trouble, and thank you for telling me!

@mweinelt
Copy link
Member

@ShamrockLee Can you resolve this quickly? If not we should probably revert for now.

@ShamrockLee
Copy link
Contributor Author

@mweinelt I'll look into it right away.

@ShamrockLee
Copy link
Contributor Author

librewolf-unwrapped is not yet available in the official binary substitutes, and I'm building it locally. Are there substitutes/build results I could use, or is there a workaround for doing a quick test?

@mweinelt
Copy link
Member

Pick this change on top of nixos-unstable to test.

@mweinelt
Copy link
Member

The wrapper should fail the same with any firefox build or fork.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-do-i-set-an-environment-variable-for-firefox/21548/8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants