I had an issue with a web app on mobile and wasn’t sure what was wrong. So, I wanted to use the “remote debugging” feature of Firefox to troubleshoot. This means I need to connnect my Android phone via adb and then connect it with the Firefox Inspector. But, unfortunately, Firefox on my Android device is 97, and my NixOS Firefox version was 94. I assumed upgrading would be simple, but no.
I tried a variety of nix-env -qa firefox but could only see this:
$ nix-env -qa firefox firefox-78.15.0esr firefox-91.3.0esr firefox-91.3.0esr firefox-91.3.0esr firefox-94.0 firefox-94.0 firefox-94.0 firefox-94.0
Nothing newer than 94. :(
Then, I read about this repository from Mozilla which provides an “overlay” for NixOS that permits you to install Firefox nightly builds. I wasn’t sure what an overlay means, but I’m game!
The steps are:
First, clone this:
$ mkdir ~/.config/nixpkgs/overlays $ cd ~/.config/nixpkgs/overlays/ $ ln -s ~/ixpkgs-mozilla/firefox-overlay.nix . $ nix-shell -p latest.firefox-beta-bin these derivations will be built: /nix/store/h0v87dqs5bwag9xg1x0fkb3796ffmh16-check-firefox-signature.drv /nix/store/grj409fklnq4dxkrmr42n9m7gp1avf3c-firefox-98.0b2.tar.bz2.drv /nix/store/i87gr5lrl2lpi4k5kmg0v0p3j96an2gr-firefox-release-bin-unwrapped-98.0b2.drv /nix/store/p5rsn0c4cizi546qjqczx3znnfv1m44h-firefox-bin-98.0b2.drv building '/nix/store/h0v87dqs5bwag9xg1x0fkb3796ffmh16-check-firefox-signature.drv'... gpg: directory '/build/tmp.FlTQ0pdOXK/.gnupg' created gpg: keybox '/build/tmp.FlTQ0pdOXK/.gnupg/pubring.kbx' created gpg: key 61B7B526D98F0353: 24 signatures not checked due to missing keys gpg: /build/tmp.FlTQ0pdOXK/.gnupg/trustdb.gpg: trustdb created gpg: key 61B7B526D98F0353: public key "Mozilla Software Releases <[email@example.com](mailto:firstname.lastname@example.org)>" imported gpg: Total number processed: 1 gpg: imported: 1 gpg: no ultimately trusted keys found gpgv: can't allocate lock for '/build/tmp.FlTQ0pdOXK/.gnupg/pubring.kbx' gpgv: Signature made Tue Feb 8 22:34:13 2022 UTC gpgv: using RSA key 4360FE2109C49763186F8E21EBE41E90F6F12F6D gpgv: Good signature from "Mozilla Software Releases <[email@example.com](mailto:firstname.lastname@example.org)>" building '/nix/store/grj409fklnq4dxkrmr42n9m7gp1avf3c-firefox-98.0b2.tar.bz2.drv'... trying [https://download.cdn.mozilla.net/pub/firefox/releases/98.0b2/linux-x86_64/en-US/firefox-98.0b2.tar.bz2](https://download.cdn.mozilla.net/pub/firefox/releases/98.0b2/linux-x86_64/en-US/firefox-98.0b2.tar.bz2) % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 74.4M 100 74.4M 0 0 995k 0 0:01:16 0:01:16 --:--:-- 1617k building '/nix/store/i87gr5lrl2lpi4k5kmg0v0p3j96an2gr-firefox-release-bin-unwrapped-98.0b2.drv'... unpacking sources unpacking source archive /nix/store/yvq8qrkmq9i0nxj8fr2ya9b3cgbbar37-firefox-98.0b2.tar.bz2 source root is firefox setting SOURCE_DATE_EPOCH to timestamp 1644352711 of file firefox/omni.ja patching sources installing post-installation fixup rewriting symlink /nix/store/mpg0zr7bqn4vpsx9idjpvhb157kdmhm2-firefox-release-bin-unwrapped-98.0b2/lib to be relative to /nix/store/mpg0zr7bqn4vpsx9idjpvhb157kdmhm2-firefox-release-bin-unwrapped-98.0b2 rewriting symlink /nix/store/mpg0zr7bqn4vpsx9idjpvhb157kdmhm2-firefox-release-bin-unwrapped-98.0b2/bin/firefox to be relative to /nix/store/mpg0zr7bqn4vpsx9idjpvhb157kdmhm2-firefox-release-bin-unwrapped-98.0b2 patching script interpreter paths in /nix/store/mpg0zr7bqn4vpsx9idjpvhb157kdmhm2-firefox-release-bin-unwrapped-98.0b2 checking for references to /build/ in /nix/store/mpg0zr7bqn4vpsx9idjpvhb157kdmhm2-firefox-release-bin-unwrapped-98.0b2... Wrapping link: '/nix/store/mpg0zr7bqn4vpsx9idjpvhb157kdmhm2-firefox-release-bin-unwrapped-98.0b2/bin/firefox' building '/nix/store/p5rsn0c4cizi546qjqczx3znnfv1m44h-firefox-bin-98.0b2.drv'...
Once that is done, you can run firefox and it will be version 98!
Each time you run the shell command, it downloads a new build. I wish I could pin it, but I think this is getting the latest nightly each time?
Combined with this command I can get the adb tools:
nix-shell -p androidenv.androidPkgs_9_0.platform-tools
Then, I can connect my Android phone and debug it in Chrome.
$ adb devices List of devices attached ZY22BNPPRV device