Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add devshell to run firefox #60

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}