-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathflake.nix
More file actions
89 lines (81 loc) · 2.86 KB
/
flake.nix
File metadata and controls
89 lines (81 loc) · 2.86 KB
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
{
description = "Architect development environment";
nixConfig = {
extra-substituters = [ "https://forketyfork.cachix.org" ];
extra-trusted-public-keys = [
"forketyfork.cachix.org-1:+0f7K77HIlUgbueZCRgRHr1GM6gMAThMetrwt0DaF3U="
];
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
zig = {
url = "github:mitchellh/zig-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, zig }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
(import ./overlays/sdl3-3-4-0.nix)
];
config = {
allowUnfree = true;
};
};
sdl3 = pkgs.sdl3;
sdl3_ttf = pkgs.sdl3-ttf;
gw = pkgs.writeShellScriptBin "gw" ''
if [ -z "$1" ]; then
echo "Usage: gw <name>"
exit 1
fi
git worktree add .architect/"$1" -b forketyfork/"$1" && cd .architect/"$1" && direnv allow
'';
in
{
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
just
ruff
shellcheck
zig.packages.${system}."0.15.2"
pkg-config
gw
];
buildInputs =
[
sdl3.dev
sdl3_ttf
]
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
pkgs.gawk
pkgs.gnused
];
shellHook = ''
export PKG_CONFIG_PATH="${sdl3}/lib/pkgconfig:${sdl3_ttf}/lib/pkgconfig:$PKG_CONFIG_PATH"
export SDL3_INCLUDE_PATH="${sdl3.dev}/include"
export SDL3_TTF_INCLUDE_PATH="${sdl3_ttf}/include"
echo "Architect development environment"
echo "Available commands: just --list, gw <name>"
''
+ (pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isDarwin ''
# On macOS, we unset the macOS SDK env vars that Nix sets up because
# we rely on a system installation.
unset SDKROOT
unset DEVELOPER_DIR
# We need to remove "xcrun" from the PATH. It is injected by
# some dependency but we need to rely on system Xcode tools
export PATH=$(echo "$PATH" | ${pkgs.gawk}/bin/awk -v RS=: -v ORS=: '$0 !~ /xcrun/ || $0 == "/usr/bin" {print}' | ${pkgs.gnused}/bin/sed 's/:$//')
# Zig 0.15.2 cannot link correctly against the arm64e-only macOS 26.4 SDK stubs.
# Remove this once we move off Zig 0.15.2 or the upstream fix lands.
project_root=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
. "$project_root/scripts/setup-macos-sdk-workaround.sh"
'');
};
}
);
}