Jump to content

Node.js: Difference between revisions

m
Fix google font override
m (Fix nix build --print-out-paths)
m (Fix google font override)
Line 200: Line 200:
import localFont from "next/font/local";
import localFont from "next/font/local";
const inter = localFont({ src: './Inter.ttf' });
const inter = localFont({ src: './Inter.ttf' });
</syntaxhighlight>and place the Google fonts from Nixpkgs into the project, e.g. in a <code>preConfigurePhase</code>:<syntaxhighlight lang="nix">
</syntaxhighlight>and place the Google fonts from Nixpkgs into the project, e.g. in a <code>preBuild</code> phase:<syntaxhighlight lang="nix">
buildNpmPackage {
buildNpmPackage {
   pname = "myproject";
   pname = "myproject";
Line 207: Line 207:


   # see https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/cr/crabfit-frontend/package.nix
   # see https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/cr/crabfit-frontend/package.nix
   preConfigurePhase = ''
   preBuild = ''
     cp "${
     cp "${
       google-fonts.override { fonts = [ "Inter" ]; }
       google-fonts.override { fonts = [ "Inter" ]; }
     }/share/fonts/truetype/Inter[wght].ttf" src/app/Inter.ttf
     }/share/fonts/truetype/Inter[slnt,wght].ttf" src/app/Inter.ttf
   '';
   '';


48

edits