-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathflake.nix
More file actions
144 lines (130 loc) · 4.81 KB
/
flake.nix
File metadata and controls
144 lines (130 loc) · 4.81 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
{
description = "Dev shell for Penumbra web development";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
# nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
crane.url = "github:ipetkov/crane";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
};
outputs = { self, nixpkgs, flake-utils, crane, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./packages/wasm/crate/rust-toolchain.toml;
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
# We need to handle `harfbuzz` delicately, otherwise libpango complains:
# `libpango-1.0.so.0: undefined symbol: hb_ot_color_has_paint`
# So we create a binding here and reference it within the playwright deps.
harfbuzz = pkgs.harfbuzz;
# OS dependencies for web browsers, used by playwright integration tests.
# Each nixpkg is annotated with the shared object it provides.
playwrightLibs = with pkgs; [
glib # libglib-2.0.so.0, libgio-2.0.so.0
glib.out # Additional search path
gobject-introspection # libgobject-2.0.so.0
nss # libnss3.so, libnssutil3.so
nspr # libnspr4.so
dbus # libdbus-1.so.3
atk # libatk-1.0.so.0
at-spi2-atk # libatk-bridge-2.0.so.0
at-spi2-core # libatspi.so.0
expat # libexpat.so.1
xorg.libX11 # libX11.so.6
xorg.libXcomposite # libXcomposite.so.1
xorg.libXdamage # libXdamage.so.1
xorg.libXext # libXext.so.6
xorg.libXfixes # libXfixes.so.3
xorg.libXrandr # libXrandr.so.2
mesa # libgbm.so.1
xorg.libxcb # libxcb.so.1
libxkbcommon # libxkbcommon.so.0
udev # libudev.so.1
alsa-lib # libasound.so.2
# Additional dependencies that Playwright wants.
cups
gtk3
# Declare harfbuzz dependency prior to pango, so its libs are available for pango.
harfbuzz
pango
cairo
freetype
fontconfig
libdrm
libva
pipewire
];
# Additional packages for the dev environment
playwrightPackages = with pkgs; [
playwright-driver.browsers
chromium
xvfb-run
harfbuzz
];
# CI and deployment tooling
deploymentTools = with pkgs; [
doctl
flyctl
kubectl
];
in with pkgs; with pkgs.lib; let
# Common development packages for all shells
commonDevPackages = [
fd
file
firefox
gum
hyperfine
jq
just
libuuid
nodejs_22
pnpm_10
postgresql
wasm-pack
] ++ playwrightPackages ++ deploymentTools;
# The uuid lib is required for social card support.
uuidLibPath = pkgs.lib.makeLibraryPath [pkgs.libuuid];
# Common shell hook content
commonShellHook = ''
export RUST_LOG="penumbra=debug"
export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc} # Required for rust-analyzer
export NEXT_TELEMETRY_DISABLED=1
export TURBO_TELEMETRY_DISABLED=1
# Override libpath so that builds succeed
export LD_LIBRARY_PATH="${uuidLibPath}:$LD_LIBRARY_PATH"
# Export the playwright browsers path, to aid in setting up CI.
export _PLAYWRIGHT_BROWSERS_PATH="${pkgs.playwright-driver.browsers}"
# If this is the first time activating the dev shell, install pnpm
if ! test -d node_modules ; then
>&2 echo "Local ./node_modules not found, run 'pnpm install'"
fi
'';
in
{
devShells = {
default = craneLib.devShell {
name = "penumbra-web devShell";
packages = commonDevPackages ++ playwrightLibs;
shellHook = ''
${commonShellHook}
'';
};
# Separate opt-in devshell that excludes rust tooling & playwright browsers.
minimal = pkgs.mkShell {
name = "minimal penumbra-web devShell";
packages = commonDevPackages;
shellHook = ''
${commonShellHook}
'';
};
};
}
);
}