Skip to content

Commit abbc9ce

Browse files
committed
feat(internal): add nix flake dev shell
1 parent c1dd267 commit abbc9ce

6 files changed

Lines changed: 212 additions & 55 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "Setup Nix"
2+
description: "Setup Nix"
3+
4+
runs:
5+
using: "composite"
6+
7+
steps:
8+
- name: Install Nix
9+
uses: samueldr/lix-gha-installer-action@7b7f14d320d6aacfb65bd1ef761566b3b69e474c
10+
11+
- name: Setup Nix cache
12+
uses: DeterminateSystems/magic-nix-cache-action@cec65ff6f104850203b152861d3f9e5f1747885d
13+
with:
14+
use-flakehub: false
15+
flakehub-api-server: ""
16+
flakehub-cache-server: ""
17+
diagnostic-endpoint: ""

.github/workflows/linux-build.yml

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ jobs:
3838
GLIDE_COMPAT: ${{ matrix.arch }}
3939
MOZ_BUILD_DATE: ${{ inputs.MOZ_BUILD_DATE }}
4040

41+
defaults:
42+
run:
43+
shell: nix develop --command bash -e {0}
44+
4145
strategy:
4246
fail-fast: false
4347
matrix:
@@ -54,20 +58,14 @@ jobs:
5458
with:
5559
persist-credentials: false
5660

61+
- uses: ./.github/actions/setup-nix
62+
5763
- name: Configure git
5864
run: |
5965
git config --global \
6066
url."https://github.com/mozilla-firefox/firefox.git".insteadOf \
6167
"git@github.com:mozilla-firefox/firefox.git"
6268
63-
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
64-
65-
- name: Setup Node.js
66-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
67-
with:
68-
node-version: "24"
69-
cache: "pnpm"
70-
7169
- name: Run sccache-cache
7270
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
7371
with:
@@ -80,13 +78,6 @@ jobs:
8078
core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL'])
8179
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN'])
8280
83-
- name: Install system dependencies
84-
run: |
85-
set -x
86-
sudo apt-get update --fix-missing
87-
sudo apt-get update
88-
sudo apt-get install -y python3 python3-pip dos2unix yasm nasm build-essential libgtk2.0-dev libpython3-dev m4 uuid libasound2-dev libcurl4-openssl-dev libdbus-1-dev libdrm-dev libdbus-glib-1-dev libgtk-3-dev libpulse-dev libx11-xcb-dev libxt-dev xvfb lld llvm
89-
9081
- name: Install dependencies
9182
run: pnpm install --frozen-lockfile
9283

@@ -95,16 +86,11 @@ jobs:
9586
pnpm bootstrap
9687
9788
cd engine
98-
export PATH="$(python3 -m site --user-base)/bin":$PATH
9989
./mach --no-interactive bootstrap --application-choice browser --no-system-changes || true
10090
cd ..
10191
102-
- name: Fix Rust version
92+
- name: Configure rust
10393
run: |
104-
# Install a rust version compatible with LLVM 18
105-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.89
106-
source $HOME/.cargo/env
107-
10894
if test "$GLIDE_COMPAT" = "aarch64"; then
10995
rustup target add aarch64-unknown-linux-gnu
11096
else

.github/workflows/macos-build.yml

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
macos-build:
3333
name: Build - ${{ matrix.arch }}
3434

35-
runs-on: depot-macos-14
35+
runs-on: depot-macos-15
3636
env:
3737
CARGO_TERM_COLOR: always
3838
GLIDE_PLATFORM: macos
@@ -42,35 +42,33 @@ jobs:
4242
GLIDE_COMPAT: ${{ matrix.arch }}
4343
MOZ_BUILD_DATE: ${{ inputs.MOZ_BUILD_DATE }}
4444

45+
defaults:
46+
run:
47+
shell: nix develop --command bash -e {0}
48+
4549
strategy:
4650
fail-fast: false
4751
matrix:
4852
arch: [aarch64, x86_64]
4953

5054
steps:
51-
- name: Debug
52-
run: |
53-
xcrun --show-sdk-version
54-
5555
- name: Checkout repository
5656
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
5757
with:
5858
persist-credentials: false
5959

60+
- uses: ./.github/actions/setup-nix
61+
62+
- name: Debug
63+
run: |
64+
xcrun --show-sdk-version
65+
6066
- name: Configure git
6167
run: |
6268
git config --global \
6369
url."https://github.com/mozilla-firefox/firefox.git".insteadOf \
6470
"git@github.com:mozilla-firefox/firefox.git"
6571
66-
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
67-
68-
- name: Setup Node.js
69-
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
70-
with:
71-
node-version: "24"
72-
cache: "pnpm"
73-
7472
- name: Run sccache-cache
7573
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9
7674
with:
@@ -83,31 +81,12 @@ jobs:
8381
core.exportVariable('ACTIONS_CACHE_URL', process.env['ACTIONS_CACHE_URL'])
8482
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN'])
8583
86-
- name: Install system dependencies
84+
- name: Configure rust
8785
run: |
88-
brew update
89-
brew install cairo gnu-tar mercurial
90-
91-
brew uninstall --ignore-dependencies python3.12 -f
92-
93-
export PATH="$(python3 -m site --user-base)/bin":$PATH
94-
95-
rm '/usr/local/bin/2to3-3.11' '/usr/local/bin/2to3-3.12' '/usr/local/bin/2to3' || true
96-
rm '/usr/local/bin/idle3.11' '/usr/local/bin/idle3.12' '/usr/local/bin/idle3' || true
97-
rm '/usr/local/bin/pydoc3.11' '/usr/local/bin/pydoc3.12' '/usr/local/bin/pydoc3' || true
98-
rm '/usr/local/bin/python3.11' '/usr/local/bin/python3.12' '/usr/local/bin/python3' || true
99-
rm '/usr/local/bin/python3.11-config' '/usr/local/bin/python3.12-config' '/usr/local/bin/python3-config' || true
100-
101-
brew install watchman
102-
103-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.89
104-
source $HOME/.cargo/env
105-
10686
if test "$GLIDE_COMPAT" = "aarch64"; then
10787
rustup target add aarch64-apple-darwin
10888
else
10989
rustup target add x86_64-apple-darwin
110-
brew install nasm
11190
fi
11291
11392
- name: Install dependencies
@@ -118,7 +97,6 @@ jobs:
11897
pnpm bootstrap
11998
12099
cd engine
121-
export PATH="$(python3 -m site --user-base)/bin":$PATH
122100
./mach --no-interactive bootstrap --application-choice browser --no-system-changes || true
123101
cd ..
124102

flake.lock

Lines changed: 97 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
4+
rust-overlay.url = "github:oxalica/rust-overlay";
5+
flake-utils.url = "github:numtide/flake-utils?ref=main";
6+
};
7+
8+
outputs = {
9+
nixpkgs,
10+
flake-utils,
11+
rust-overlay,
12+
...
13+
}:
14+
flake-utils.lib.eachDefaultSystem (
15+
system: let
16+
overlays = [(import rust-overlay)];
17+
pkgs = import nixpkgs {
18+
inherit system overlays;
19+
};
20+
in {
21+
devShell = pkgs.mkShell {
22+
buildInputs = with pkgs;
23+
[
24+
(pnpm.override {nodejs = nodejs_24;})
25+
nodejs_24
26+
python314
27+
uv
28+
rust-bin.beta.latest.default
29+
watchman
30+
cairo
31+
gnutar
32+
mercurial
33+
nasm
34+
rust-cbindgen
35+
rustPlatform.bindgenHook
36+
]
37+
++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [
38+
apple-sdk_26
39+
])
40+
++ pkgs.lib.optionals pkgs.stdenv.isLinux (with pkgs; [
41+
yasm
42+
gnumake
43+
gcc
44+
gtk2
45+
m4
46+
util-linux
47+
alsa-lib
48+
curl
49+
dbus
50+
libdrm
51+
dbus-glib
52+
gtk3
53+
libpulseaudio
54+
libX11
55+
libxcb
56+
libXt
57+
xvfb-run
58+
lld
59+
llvm
60+
dos2unix
61+
pkg-config
62+
]);
63+
};
64+
}
65+
);
66+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
2+
index 47061339da913be4adde21702df86fa21958156f..23a6df47b55c2aed3bcbe79e01f5cb6e6271bd70 100644
3+
--- a/build/moz.configure/toolchain.configure
4+
+++ b/build/moz.configure/toolchain.configure
5+
@@ -240,7 +240,7 @@ with only_when(host_is_osx | target_is_osx):
6+
)
7+
8+
def mac_sdk_min_version():
9+
- return "26.2"
10+
+ return "26.0"
11+
12+
@depends(
13+
"--with-macos-sdk",

0 commit comments

Comments
 (0)