Skip to content

Commit fb89791

Browse files
iniwtimschumi
authored andcommitted
Nix: Add the necessary packages/build inputs for building on Darwin
1 parent fc00fe4 commit fb89791

File tree

2 files changed

+61
-36
lines changed

2 files changed

+61
-36
lines changed

Documentation/BuildInstructionsMacOS.md

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ brew install llvm@18
3636
brew install gcc@13
3737
```
3838

39+
# Nix
40+
41+
If Nix is installed, entering the devshell will provide an environment with all required build dependencies already included.
42+
43+
```
44+
nix --extra-experimental-features "nix-command flakes" develop
45+
```
46+
3947
# Notes
4048

4149
You can use both Intel and Apple Silicon Macs to run a native architecture version of SerenityOS.

Toolchain/default.nix

+53-36
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,59 @@
33
}:
44
with pkgs;
55

6-
mkShell.override { stdenv = gcc13Stdenv; } {
7-
packages = [
8-
ccache
9-
cmake
10-
curl
11-
e2fsprogs
12-
fuse2fs
13-
gcc13
14-
gmp
15-
libmpc
16-
mpfr
17-
ninja
18-
patch
19-
pkg-config
20-
rsync
21-
texinfo
22-
unzip
23-
# To build the GRUB disk image
24-
grub2
25-
libxcrypt
26-
openssl
27-
parted
28-
qemu
29-
python3
30-
# For building and installing ports
31-
autoconf
32-
automake
33-
gperf
34-
imagemagick
35-
libtool
36-
# For clangd and clang-format
37-
clang-tools
38-
# For LibWeb-related formatting
39-
nodePackages.prettier
40-
# For the pre-commit hooks
41-
pre-commit
6+
mkShell.override { stdenv = gccStdenv; } {
7+
packages =
8+
[
9+
ccache
10+
cmake
11+
curl
12+
e2fsprogs
13+
flex
14+
git
15+
gmp
16+
libmpc
17+
libxcrypt
18+
mpfr
19+
ninja
20+
openssl
21+
patch
22+
pkg-config
23+
python3
24+
qemu
25+
rsync
26+
texinfo
27+
unzip
28+
wget
29+
# For building and installing ports
30+
autoconf
31+
automake
32+
gperf
33+
imagemagick
34+
libtool
35+
# For development
36+
clang-tools
37+
nodePackages.prettier
38+
pre-commit
39+
]
40+
++ lib.optionals stdenv.isLinux [
41+
fuse
42+
fuse-ext2
43+
grub2
44+
parted
45+
]
46+
++ lib.optionals stdenv.isDarwin [
47+
genext2fs
48+
];
49+
50+
buildInputs = lib.optionals stdenv.isDarwin [
51+
apple-sdk_13
52+
(darwinMinVersionHook "13.3")
4253
];
54+
55+
shellHook = ''
56+
# The toolchain is built with `mtune=native` which nix warns about, but we don't care about that warning.
57+
export NIX_ENFORCE_NO_NATIVE=0
58+
'';
59+
4360
hardeningDisable = [ "format" ];
4461
}

0 commit comments

Comments
 (0)