Skip to content

Commit

Permalink
add devshell to run firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 committed Jan 3, 2024
1 parent d7cfc33 commit f78cdde
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ What environments should **not** include:
| [Arduino](envs/arduino) | `arduino` |
| [cc2538-bsl](envs/cc2538-bsl) | `cc2538-bsl` |
| [Jruby](envs/jruby) | `jruby` |
| [Firefox](envs/firefox) | `firefox` |
| [Github Pages](envs/github-pages) | `github-pages` |
| [Homeassistant](envs/home-assistant) | `home-assistant` |
| [Nannou](envs/nannou) | `nannou` |
Expand Down
1 change: 1 addition & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ pkgs ? import <nixpkgs> {} }: {
arduino = import ./envs/arduino/shell.nix { inherit pkgs; };
cc2538-bsl = import ./envs/cc2538-bsl/shell.nix { inherit pkgs; };
firefox = import ./envs/firefox/shell.nix { inherit pkgs; };
github-pages = import ./envs/github-pages/shell.nix { inherit pkgs; };
home-assistant = import ./envs/home-assistant/shell.nix { inherit pkgs; };
nannou = import ./envs/nannou/shell.nix { inherit pkgs; };
Expand Down
26 changes: 26 additions & 0 deletions envs/firefox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Firefox development environment

**Disclaimer:** This setup currently also requies nix-ld (https://github.com/Mic92/nix-ld) to run binaries provided by mozilla.

This [envrc](https://direnv.net/) will setup a virtualenv for the buildsystem:

```
use nix
layout python
export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH
```

To clone the repository:

```
$ curl https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py -O
$ python3 bootstrap.py
```

To build & run firefox

```
./mach configure
./mach build
./mach run
```
32 changes: 32 additions & 0 deletions envs/firefox/shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{ pkgs ? import <nixpkgs> { }
, extraPkgs ? [ ]
}:
let
# Target the LLVM version that rustc is built with for LTO.
llvmPackages0 = pkgs.rustc.llvmPackages;

# Force the use of lld and other llvm tools for LTO
llvmPackages = llvmPackages0.override {
bootBintoolsNoLibc = null;
bootBintools = null;
};

# LTO requires LLVM bintools including ld.lld and llvm-ar.
buildStdenv = pkgs.overrideCC llvmPackages.stdenv (llvmPackages.stdenv.cc.override {
bintools = pkgs.buildPackages.rustc.llvmPackages.bintools;
});
in
buildStdenv.mkDerivation {
name = "env";
nativeBuildInputs = [
pkgs.bashInteractive
pkgs.mercurial
pkgs.rustc
pkgs.cargo
pkgs.unzip
pkgs.m4
pkgs.pkg-config
pkgs.python3
] ++ pkgs.lib.optional (!pkgs.stdenv.isDarwin) pkgs.libnotify
++ extraPkgs;
}

0 comments on commit f78cdde

Please sign in to comment.