-
Notifications
You must be signed in to change notification settings - Fork 51
/
flake.nix
102 lines (96 loc) · 2.89 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{
description = "Development environment flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
# List of supported macOS SDK versions.
sdk_versions = [ "11" "12" "13" "14" "15" ];
default_sdk_version = "11";
mkDevShell = { macos_version ? default_sdk_version }:
let
apple_sdk = pkgs.${"apple-sdk_${macos_version}"};
in
pkgs.mkShell {
# Package list specifically excludes ncurses, so that we link
# against the system version of ncurses. This ensures emacs' TUI
# works out of the box without the user having to manually set
# TERMINFO in the shell before launching emacs.
packages = with pkgs; [
apple_sdk
autoconf
bash
cairo
clang
coreutils
curl
darwin.DarwinTools # sw_vers
dbus
expat
findutils
gcc
gettext
giflib
git
gmp
gnumake
gnupatch
gnused
gnutar
gnutls
harfbuzz
jansson
jq
lcms2
libffi
libgccjit
libiconv
libjpeg
libpng
librsvg
libtasn1
libunistring
libwebp
libxml2
mailutils
nettle
pkg-config
python3
rsync
ruby_3_3
sqlite
texinfo
time
tree-sitter
which
xcbuild
zlib
];
shellHook = ''
export CC=clang
export MACOSX_DEPLOYMENT_TARGET="${macos_version}.0"
export DEVELOPER_DIR="${apple_sdk}"
export NIX_LIBGCCJIT_VERSION="${pkgs.libgccjit.version}"
export NIX_LIBGCCJIT_ROOT="${pkgs.libgccjit.outPath}"
export BUNDLE_WITHOUT=development
'';
};
# Generate an attrset of shells for each macOS SDK version.
versionShells = builtins.listToAttrs (
map (version: {
name = "macos${version}";
value = mkDevShell { macos_version = version; };
}) sdk_versions
);
in
{
devShells = versionShells // {
default = mkDevShell {};
};
}
);
}