Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ad02b74

Browse files
authored
fix(flake.nix): fix site build & add missing inputs for darwin hosts (#16153)
- update `flake.nix`: - use `devShells.default` instead of `devShell` - include macOS-specific build inputs - use the same nodejs version in the default devShell and pnpm frontend build - update `site/.npmrc` to include tarball URLs for a reproducible Nix build. Change-Id: I28f0e301298806f251121cc93224740bcc02bcba Signed-off-by: Thomas Kosiewski <[email protected]>
1 parent 3e3de05 commit ad02b74

File tree

3 files changed

+1337
-1321
lines changed

3 files changed

+1337
-1321
lines changed

flake.nix

+22-10
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
inherit system;
3333
};
3434

35-
nodejs = pkgs.nodejs-18_x;
35+
nodejs = pkgs.nodejs_20;
3636
# Check in https://search.nixos.org/packages to find new packages.
3737
# Use `nix --extra-experimental-features nix-command --extra-experimental-features flakes flake update`
3838
# to update the lock file if packages are out-of-date.
@@ -88,6 +88,7 @@
8888
less
8989
mockgen
9090
moreutils
91+
nix-prefetch-git
9192
nfpm
9293
nodejs
9394
neovim
@@ -119,9 +120,17 @@
119120

120121
# buildSite packages the site directory.
121122
buildSite = pnpm2nix.packages.${system}.mkPnpmPackage {
123+
inherit nodejs;
124+
122125
src = ./site/.;
123126
# Required for the `canvas` package!
124-
extraBuildInputs = with pkgs; [ pkgs.cairo pkgs.pango pkgs.pixman ];
127+
extraBuildInputs = with pkgs; [
128+
cairo
129+
pango
130+
pixman
131+
libpng libjpeg giflib librsvg
132+
python312Packages.setuptools
133+
] ++ ( lib.optionals stdenv.targetPlatform.isDarwin [ darwin.apple_sdk.frameworks.Foundation xcbuild ] );
125134
installInPlace = true;
126135
distDir = "out";
127136
};
@@ -161,15 +170,18 @@
161170
};
162171
in
163172
{
164-
devShell = pkgs.mkShell {
165-
buildInputs = devShellPackages;
166-
shellHook = ''
167-
export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-driver.browsers}
168-
export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true
169-
'';
170-
171-
LOCALE_ARCHIVE = with pkgs; lib.optionalDrvAttr stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive";
173+
devShells = {
174+
default = pkgs.mkShell {
175+
buildInputs = devShellPackages;
176+
shellHook = ''
177+
export PLAYWRIGHT_BROWSERS_PATH=${pkgs.playwright-driver.browsers}
178+
export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true
179+
'';
180+
181+
LOCALE_ARCHIVE = with pkgs; lib.optionalDrvAttr stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive";
182+
};
172183
};
184+
173185
packages = {
174186
proto_gen_go = proto_gen_go_1_30;
175187
all = pkgs.buildEnv {

site/.npmrc

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
save-exact=true
22
engine-strict=true
3+
4+
# Needed for nix builds of the site; see: https://github.com/nzbr/pnpm2nix-nzbr/issues/33#issuecomment-2381628294
5+
lockfile-include-tarball-url=true

0 commit comments

Comments
 (0)