Skip to content

Commit f2e9eb6

Browse files
committed
feat(internal): add nix flake dev shell
1 parent 8ad1904 commit f2e9eb6

4 files changed

Lines changed: 164 additions & 33 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/macos-build.yml

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -39,35 +39,33 @@ jobs:
3939
GLIDE_COMPAT: ${{ matrix.arch }}
4040
MOZ_BUILD_DATE: ${{ inputs.MOZ_BUILD_DATE }}
4141

42+
defaults:
43+
run:
44+
shell: nix develop --command bash -e {0}
45+
4246
strategy:
4347
fail-fast: false
4448
matrix:
4549
arch: [aarch64, x86_64]
4650

4751
steps:
48-
- name: Debug
49-
run: |
50-
xcrun --show-sdk-version
51-
5252
- name: Checkout repository
5353
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
5454
with:
5555
persist-credentials: false
5656

57+
- uses: ./.github/actions/setup-nix
58+
59+
- name: Debug
60+
run: |
61+
xcrun --show-sdk-version
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,31 +78,12 @@ 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
81+
- name: Configure rust
8482
run: |
85-
brew update
86-
brew install cairo gnu-tar mercurial
87-
88-
brew uninstall --ignore-dependencies python3.12 -f
89-
90-
export PATH="$(python3 -m site --user-base)/bin":$PATH
91-
92-
rm '/usr/local/bin/2to3-3.11' '/usr/local/bin/2to3-3.12' '/usr/local/bin/2to3' || true
93-
rm '/usr/local/bin/idle3.11' '/usr/local/bin/idle3.12' '/usr/local/bin/idle3' || true
94-
rm '/usr/local/bin/pydoc3.11' '/usr/local/bin/pydoc3.12' '/usr/local/bin/pydoc3' || true
95-
rm '/usr/local/bin/python3.11' '/usr/local/bin/python3.12' '/usr/local/bin/python3' || true
96-
rm '/usr/local/bin/python3.11-config' '/usr/local/bin/python3.12-config' '/usr/local/bin/python3-config' || true
97-
98-
brew install watchman
99-
100-
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.89
101-
source $HOME/.cargo/env
102-
10383
if test "$GLIDE_COMPAT" = "aarch64"; then
10484
rustup target add aarch64-apple-darwin
10585
else
10686
rustup target add x86_64-apple-darwin
107-
brew install nasm
10887
fi
10988
11089
- name: Install dependencies
@@ -115,7 +94,6 @@ jobs:
11594
pnpm bootstrap
11695
11796
cd engine
118-
export PATH="$(python3 -m site --user-base)/bin":$PATH
11997
./mach --no-interactive bootstrap --application-choice browser --no-system-changes || true
12098
cd ..
12199

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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
(pnpm.override {nodejs = nodejs_24;})
24+
nodejs_24
25+
python314
26+
uv
27+
rust-bin.beta.latest.default
28+
watchman
29+
cairo
30+
gnutar
31+
mercurial
32+
33+
# needed for macos intel builds
34+
nasm
35+
];
36+
};
37+
}
38+
);
39+
}

0 commit comments

Comments
 (0)