Conversation
|
Opened this PR as requested by @SuperSandro2000, this fixes the currently broken firefox binary. But be warned, I have a very basic understanding of Nix, feedback welcome EDIT: I'm also not entirely sure why it fixes Firefox, I think the Playwright maintainers run some patches in order to enable remote control |
|
Your commit message doesn't fit with Contributing.md. In this case I think it should be |
fa746cb to
7a2a84f
Compare
|
@ofborg build playwright |
|
done @xanderio |
|
Result of |
|
Interesting |
| "https://raw.githubusercontent.com/microsoft/playwright/v${driverVersion}/packages/playwright-core/browsers.json"; | ||
| sha256 = "11a1n65l43nfyjn0qrsjjyjl7psvqa67k4kiv8x624faga4zl3mk"; | ||
| }; | ||
| raw_data = fromJSON (readFile file); |
There was a problem hiding this comment.
| raw_data = fromJSON (readFile file); | |
| raw_data = lib.importJSON file; |
| }: | ||
|
|
||
| let | ||
| inherit (builtins) fromJSON readFile listToAttrs; |
There was a problem hiding this comment.
| inherit (builtins) fromJSON readFile listToAttrs; |
| selectSystem = attrs: | ||
| attrs.${system} or (throw "Unsupported system: ${system}"); |
There was a problem hiding this comment.
| selectSystem = attrs: | |
| attrs.${system} or (throw "Unsupported system: ${system}"); | |
| selectSystem = attrs: attrs.${system} or (throw "Unsupported system: ${system}"); |
| url = | ||
| "https://raw.githubusercontent.com/microsoft/playwright/v${driverVersion}/packages/playwright-core/browsers.json"; |
There was a problem hiding this comment.
| url = | |
| "https://raw.githubusercontent.com/microsoft/playwright/v${driverVersion}/packages/playwright-core/browsers.json"; | |
| url = "https://raw.githubusercontent.com/microsoft/playwright/v${driverVersion}/packages/playwright-core/browsers.json"; |
| listToAttrs (map | ||
| ({ name, revision, ... }: { | ||
| inherit name; | ||
| value = revision; | ||
| }) | ||
| raw_data.browsers); |
There was a problem hiding this comment.
| listToAttrs (map | |
| ({ name, revision, ... }: { | |
| inherit name; | |
| value = revision; | |
| }) | |
| raw_data.browsers); | |
| listToAttrs (map ( | |
| { name, revision, ... }: { | |
| inherit name; | |
| value = revision; | |
| } | |
| ) raw_data.browsers); |
|
|
||
| # patchelf the binary | ||
| wrapper="${firefox-bin}/bin/firefox" | ||
| binary="$(readlink -f $(<"$wrapper" grep '^exec ' | grep -o -P '/nix/store/[^"]+' | head -n 1))" |
There was a problem hiding this comment.
This is at a fixed location? Or can we get that from the firefox attr via passthru?
| interpreter="$(patchelf --print-interpreter "$binary")" | ||
| rpath="$(patchelf --print-rpath "$binary")" | ||
|
|
||
| find $firefoxoutdir/ -executable -type f | while read i; do | ||
| chmod u+w "$i" | ||
| [[ $i == *.so ]] || patchelf --set-interpreter "$interpreter" "$i" | ||
| patchelf --set-rpath "$rpath" "$i" |
There was a problem hiding this comment.
| interpreter="$(patchelf --print-interpreter "$binary")" | |
| rpath="$(patchelf --print-rpath "$binary")" | |
| find $firefoxoutdir/ -executable -type f | while read i; do | |
| chmod u+w "$i" | |
| [[ $i == *.so ]] || patchelf --set-interpreter "$interpreter" "$i" | |
| patchelf --set-rpath "$rpath" "$i" | |
| find $firefoxoutdir/ -executable -type f | while read file; do | |
| chmod u+w "$file" | |
| [[ $file == *.so ]] || patchelf --set-interpreter "$(patchelf --print-interpreter "$binary")" "$file" | |
| patchelf --set-rpath "$(patchelf --print-rpath "$binary")" "$file" |
| chmod u+w "$i" | ||
| [[ $i == *.so ]] || patchelf --set-interpreter "$interpreter" "$i" | ||
| patchelf --set-rpath "$rpath" "$i" | ||
| chmod u-w "$i" |
There was a problem hiding this comment.
| chmod u-w "$i" |
fixed by nix
|
|
||
| # create the wrapper script | ||
| rm $firefoxoutdir/firefox | ||
| <"$wrapper" grep -vE '^exec ' > $firefoxoutdir/firefox |
There was a problem hiding this comment.
I am not sure what this line does
| echo "exec \"$firefoxoutdir/firefox-bin\" \"\$@\"" >> $firefoxoutdir/firefox | ||
| chmod a+x $firefoxoutdir/firefox |
There was a problem hiding this comment.
We can't use wrapProgram?
|
would you mind updating the PR following up on #223382 ? I am willing to help review/get merged |
|
'sure', but its been ~6 months, so I have completely forgotten what this is about :) |
|
playwright patches browsers to be able to work. Their team makes these patched browsers available on azure. Currently we use nixpkgs' browsers without patches which seems ok for chromium (I was not able to test but I suppose advanced scenarios fail without patches, otherwise what's the point of these patches xD) but from what I read unpatched firefox completely breaks with playwright. |
|
@teto , I'll have a look when I have time, but am quite busy at the moment. Hopefully I'll be able to re-add Firefox support soon |
|
firefox support was added in #298944 and this is old. Thanks for the effort. Closing |
Description of changes
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes