Open bbigras opened 10 months ago
Any ideas?
One of your dependencies (it looks like @next/font) tries to download the font as part of the build process. The nix build sandbox blocks network access however, so this fails. You need to somehow convince it to use an already downloaded copy of the font (you can get that from nixpkgs as pkgs.inter
).
Or you include it as a local font and install the font files itself through npm
adding __noChroot = true
to mkPnpmPackage seems to give internet access I can use ping
but for some reason I get https certificate error not sure why
here's the flake.nix
{
description = "Test Flake";
inputs = {
nixpkgs.url = "nixpkgs";
systems.url = "github:nix-systems/x86_64-linux";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
pnpm2nix = {
url = "github:nzbr/pnpm2nix-nzbr";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, flake-utils, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
pname = "test-flake";
version = "0.1.0";
buildInputs = with pkgs; [
nodejs_20
nodePackages_latest.pnpm
];
in
{
devShells.default = pkgs.mkShell {
inherit buildInputs;
shellHook = ''
#!/usr/bin/env bash
'';
};
packages.default = inputs.pnpm2nix.packages.${system}.mkPnpmPackage {
__noChroot = true; # disable nix sandbox to get internet access
inherit pname version;
src = ./.;
# uncomment to test ping or pnpm build
buildPhase = ''
# ${pkgs.pkgs.unixtools.ping}/bin/ping 8.8.8.8
# pnpm run build
'';
};
});
}
in order to use __noChroot
you have to set nix.settings.sandbox = "relaxed"
and build your system
Error log:
> next build
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
▲ Next.js 14.1.4
Creating an optimized production build ...
request to https://fonts.googleapis.com/css2?family=Rubik:wght@300..900&display=swap failed, reason: unable to get local issuer certificate
Retrying 1/3...
request to https://fonts.googleapis.com/css2?family=Rubik:wght@300..900&display=swap failed, reason: unable to get local issuer certificate
Retrying 2/3...
request to https://fonts.googleapis.com/css2?family=Rubik:wght@300..900&display=swap failed, reason: unable to get local issuer certificate
Retrying 3/3...
FetchError: request to https://fonts.googleapis.com/css2?family=Rubik:wght@300..900&display=swap failed, reason: unable to get local issuer certificate
at ClientRequest.<anonymous> (/nix/store/n4rzfg89chlgws0gkk1x79ipij7fkz3w-test-flake-0.1.0-node-modules/node_modules/.pnpm/next@14.1.4_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/node-fetch/index.js:1:66160)
at ClientRequest.emit (node:events:518:28)
at TLSSocket.socketErrorListener (node:_http_client:495:9)
at TLSSocket.emit (node:events:518:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
type: 'system',
errno: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
code: 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY'
}
next build
builds fine but not withnix build
flake.nix
front.nix