Error Building Custom NixOS ISO: `Could not find/open font`

Hi everyone,

I’m currently working on building a custom NixOS ISO with river window manager, and I’ve encountered an issue that I can’t seem to resolve. During the build process, I receive the following error message:

> Error: Could not find/open font

I’ve tried troubleshooting the issue on my own, but I’m not having much luck. Here is a link to the full build logs for more context: Logs.

Here are parts of logs:

error: builder for '/nix/store/f6b4wz567x8w4i2rgwrlpjn4721qsyxj-wayland-1.22.0.drv' failed with exit code 1;
       last 30 log lines:
       > Error: Could not find/open font
       > Error: Could not find/open font
       > [4/107] Generating doc/doxygen/xml/x-architecture.png with a custom command
       > FAILED: doc/doxygen/xml/x-architecture.png
       > /nix/store/147d9l53l4b71hywypbcgkcq9pbclhb1-graphviz-10.0.1/bin/dot -Tpng -odoc/doxygen/xml/x-architecture.png ../doc/doxygen/dot/x-architecture.gv
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Warning: no value for width of non-ASCII character 226. Falling back to width of space character
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Error: Could not find/open font
       > Error: Could not find/open font
       > [5/107] Generating src/wayland.dtd.h with a custom command (wrapped by meson to capture output)
       > [6/107] Compiling C object src/libwayland-private.a.p/wayland-os.c.o
       > [7/107] Compiling C object src/libwayland-util.a.p/wayland-util.c.o
       > [8/107] Compiling C object src/libwayland-private.a.p/connection.c.o
       > ninja: build stopped: subcommand failed.
       For full logs, run 'nix log /nix/store/f6b4wz567x8w4i2rgwrlpjn4721qsyxj-wayland-1.22.0.drv'.
error: 1 dependencies of derivation '/nix/store/8jsja9dz3l99fbz16c1ffkjqw243x6b0-vulkan-loader-1.3.283.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/c38wyxx14f76idjazwnjj6hy7fm7ai86-wayland-protocols-1.35.drv' failed to build
error: 2 dependencies of derivation '/nix/store/l2wgwchga23gg2ig710xmspy8np3skr0-egl-wayland-1.1.14.drv' failed to build
error: 2 dependencies of derivation '/nix/store/zhsmr9xqb8ac5b9mpm0d9m4f2l58x2a0-grim-1.4.1.drv' failed to build
error: 2 dependencies of derivation '/nix/store/jfsz33mqsnsqaj3i7nag6jwl08p9y420-libxkbcommon-1.7.0.drv' failed to build
error: 3 dependencies of derivation '/nix/store/j53ml0qzq25l5ba707bvkc0wv32dcfk0-mesa-24.1.2.drv' failed to build
error: 2 dependencies of derivation '/nix/store/2dx1ajljdfmgi28pr9wgidfwf47r29h6-wl-clipboard-2.2.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/blrhscfhhjmhg3j5wg3hij5q4qphi0y7-graphics-drivers.drv' failed to build
error: 3 dependencies of derivation '/nix/store/pq5sbh4zr7cwp82spw04g16q7iflygm8-gtk+3-3.24.42.drv' failed to build
error: 3 dependencies of derivation '/nix/store/vyczgnc2sa5ksd1abddslv31ih74qhqj-gtk+3-3.24.42.drv' failed to build
error: 4 dependencies of derivation '/nix/store/ra7sn524zfv7znbzfwy42sqw3srifi55-gtk4-4.14.4.drv' failed to build
error: 1 dependencies of derivation '/nix/store/4nd1h602w7adfrai69bjk4q2wsg5av4n-libei-1.2.1.drv' failed to build
error: 3 dependencies of derivation '/nix/store/fz3zy8ss9y4s3zc8gwf26vjm12bxvjy3-slurp-1.5.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/1gbgdzgcv12l1114kd9bpgsq5nfmv75a-xkbvalidate.drv' failed to build

Code causing the problem:

{
  pkgs,
  inputs,
  config,
  ...
}: [
  (inputs.wrapper-manager.lib.build {
    inherit pkgs;
    modules = [
      {
        wrappers = {
           foot = import ./configs/foot {inherit inputs pkgs cfg;};     
        };
      }
    ];
  })
  (import ./configs/river {inherit pkgs config;})
]

Additional Information:

  • I have also tried using different window managers (such as Sway) without using the wrapper-manager, but the issue persists. Additionally, I attempted using different CD/DVD images (e.g., installation-cd-graphical-gnome, iso-image.nix), but the problem remains the same.

Has anyone encountered a similar issue or can provide guidance on how to fix this font-related error during the ISO build process?

Thanks in advance for any help or suggestions!

Meldurindir

What Nixpkgs revision are you using?

Are you using any overlays or perhaps environment.noXlibs option? That is not well supported and might need hacks like nixos/no-x-libs: add python3.pkgs.matplotlib by SuperSandro2000 · Pull Request #233451 · NixOS/nixpkgs · GitHub Though since you are using a graphical software like River, you do not want to disable graphical libraries anyway.

Yes, I was able to solve it, thank you! The issue arose because I was using the iso-image.nix installer for its additional options, but everything was resolved when I switched to installation-cd-graphical-base.nix. I suspect that you might need to enable the fonts manually when using the iso-image.nix installer.

I have one more question. I’m currently trying to enable GTK themes in this ISO, but for some reason, they’re not being applied. Specifically, I don’t see a settings.ini file for either GTK3 or GTK4. Additionally, I’m wondering if there’s a way to use wrapper-manager to manage the config files via environment variables. While the build process doesn’t throw any errors, it seems that the environment variables aren’t being updated in the ISO.

Here is what my gtk.nix:

#
# GTK 2/3/4 configurations
#
# This is fully dynamic custom gtk theme configuration. It is using adw-gtk3-dark as
# the base theme and overrides it with the my own custom colors.
#
{
  osConfig,
  config,
  pkgs,
  lib,
  ...
}: let
  inherit (lib) mkIf;

  colors = import ./theme.nix {
    inherit osConfig pkgs;
  };
in {
  config = {
    xdg.systemDirs.data = let
      schema = pkgs.gsettings-desktop-schemas;
    in ["${schema}/share/gsettings-schemas/${schema.name}"];

    home = {
      packages = with pkgs; [
        glib # gsettings
      ];

      sessionVariables = {
        # set GTK theme to the name specified by the gtk theme package
        GTK_THEME = "adw-gtk3-dark"; 

        # gtk applications should use filepickers specified by xdg
        GTK_USE_PORTAL = "${toString (lib.boolToNum true)}";
      };
    };

    # Setup the base theme
    home.file.".local/share/themes/adw-gtk3-dark" = {
      source = ./adw-gtk3-dark;
      recursive = true;
    };

    gtk = {
      theme = {
        # I use adw-gtk3-dark as the base theme and override it with my own
        # gtk color scheme
        name = "adw-gtk3-dark";
      };

      iconTheme = {
        name = "Papirus-Dark";
        package = pkgs.catppuccin-papirus-folders.override {
          accent = "blue"; # "mauve";
          flavor = "mocha";
        };
      };

      font = {
        name = "Lexend";
        size = 14;
      };

      gtk2 = {
        configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
        extraConfig = ''
          gtk-xft-antialias=1
          gtk-xft-hinting=1
          gtk-xft-hintstyle="hintslight"
          gtk-xft-rgba="rgb"
        '';
      };

      gtk3.extraConfig = {
        # gtk-application-prefer-dark-theme = true;
        gtk-toolbar-style = "GTK_TOOLBAR_BOTH";
        gtk-toolbar-icon-size = "GTK_ICON_SIZE_LARGE_TOOLBAR";
        gtk-decoration-layout = "appmenu:none";
        gtk-button-images = 1;
        gtk-menu-images = 1;
        gtk-enable-event-sounds = 0;
        gtk-enable-input-feedback-sounds = 0;
        gtk-xft-antialias = 1;
        gtk-xft-hinting = 1;
        gtk-xft-hintstyle = "hintslight";
        gtk-error-bell = 0;
      };

      gtk4.extraConfig = {
        # gtk-application-prefer-dark-theme = true;
        gtk-decoration-layout = "appmenu:none";
        gtk-enable-event-sounds = 0;
        gtk-enable-input-feedback-sounds = 0;
        gtk-xft-antialias = 1;
        gtk-xft-hinting = 1;
        gtk-xft-hintstyle = "hintslight";
        gtk-error-bell = 0;
      };
    };

    # This will override the base theme with the colorscheme
    # defined in gtk.css
    xdg.configFile = let
      gtkColors = builtins.readFile colors;
    in {
      "gtk-3.0/gtk.css".text = gtkColors;
      "gtk-4.0/gtk.css".text = gtkColors;
    };
  };
}

This gtk.nix config is based on raf’s dotfiles but uses my own custom theme.

That has nothing to do with enabling fonts – packages are built in sandbox so it does not matter what you have enabled on the system. The wayland package build fails because the minimal profile enables noXlibs, which applies an overlay that is essentially equivalent to the Baton Roue meme.

You will probably be better off with sticking to one question per thread. Especially since this one uses unrelated title and has already been marked solved.

For example, I have no idea what wrapper-manager is – but if you mention it in a title, you will have a better chance of attracting someone familiar with it.