Fontconfig seemingly depends on deprecated Electron. Why?

I’ve been trying to update my system (which is flake-based, and uses home-manager, if that matters), and have been encountering some ..strange errors:

The error
error:
       … while calling the 'head' builtin
         at «github:nixos/nixpkgs/753cc8a3a87467296ddd1fa93f0cc3e81120ee46?narHash=sha256-KesHgItiZPgGX740axSiQLcIQ8D24MDqNpkKYWIek8k%3D»/lib/attrsets.nix:1719:13:
         1718|           if length values == 1 || pred here (elemAt values 1) (head values) then
         1719|             head values
             |             ^
         1720|           else

       … while evaluating the attribute 'value'
         at «github:nixos/nixpkgs/753cc8a3a87467296ddd1fa93f0cc3e81120ee46?narHash=sha256-KesHgItiZPgGX740axSiQLcIQ8D24MDqNpkKYWIek8k%3D»/lib/modules.nix:1149:7:
         1148|     // {
         1149|       value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |       ^
         1150|       inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build.toplevel':

       … while evaluating definitions from `/nix/store/7hlsbdxjq2mgczhlipabzn52sarzx0yd-source/nixos/modules/system/activation/top-level.nix':

       … while evaluating the option `warnings':

       … while evaluating definitions from `/nix/store/7hlsbdxjq2mgczhlipabzn52sarzx0yd-source/nixos/modules/system/boot/systemd.nix':

       … while evaluating the option `systemd.services.home-manager-flyxx.serviceConfig':

       … while evaluating definitions from `/nix/store/j7lmjk2qc9nlwfjy6afbhnwr8krkck1c-source/nixos':

       … while evaluating the option `home-manager.users.flyxx.home.file."/home/flyxx/.config/fontconfig/conf.d/10-hm-fonts.conf".source':

       … while evaluating definitions from `/nix/store/j7lmjk2qc9nlwfjy6afbhnwr8krkck1c-source/modules/misc/xdg':

       … while evaluating the option `home-manager.users.flyxx.xdg.configFile."fontconfig/conf.d/10-hm-fonts.conf".source':

       … while evaluating definitions from `/nix/store/j7lmjk2qc9nlwfjy6afbhnwr8krkck1c-source/modules/misc/fontconfig.nix':

       … while evaluating the option `home-manager.users.flyxx.fonts.fontconfig.configFile.fonts.source':

       … while evaluating definitions from `/nix/store/j7lmjk2qc9nlwfjy6afbhnwr8krkck1c-source/modules/misc/fontconfig.nix':

       … while evaluating the option `home-manager.users.flyxx.fonts.fontconfig.configFile.fonts.settings':

       … while evaluating definitions from `/nix/store/j7lmjk2qc9nlwfjy6afbhnwr8krkck1c-source/modules/misc/fontconfig.nix':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: Refusing to evaluate package 'electron-40.10.5' in /nix/store/7hlsbdxjq2mgczhlipabzn52sarzx0yd-source/pkgs/develo
pment/tools/electron/binary/generic.nix:50 because it is marked as insecure

       Known issues:
        - Electron version 40.10.5 is EOL

       You can install it anyway by allowing this package, using the
       following methods:

       a) To temporarily allow all insecure packages, you can use an environment
          variable for a single invocation of the nix tools:

            $ export NIXPKGS_ALLOW_INSECURE=1

          Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
                then pass `--impure` in order to allow use of environment variables.

       b) for `nixos-rebuild` you can add ‘electron-40.10.5’ to
          `nixpkgs.config.permittedInsecurePackages` in the configuration.nix,
          like so:

            {
              nixpkgs.config.permittedInsecurePackages = [
                "electron-40.10.5"
              ];
            }

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
          ‘electron-40.10.5’ to `permittedInsecurePackages` in
          ~/.config/nixpkgs/config.nix, like so:

            {
              permittedInsecurePackages = [
                "electron-40.10.5"
              ];
            }

(this being after running nix flake update --flake ., and then nixos-rebuild boot.)

I am confused, because first of all, the error is coming from something Fontconfig-related (or at least, that is the base ). This feels like a highly unintuitive origin of such a dependency, to put it lightly.

Second, accepting the premise that somehow Fontconfig relies on Electron: I took a look at the source code being evaluated, and there is ..no mention of Electron. Anywhere. (That being said, it is possible that I maybe just didn’t look hard enough, of course. But somehow I doubt that, because Electron dependencies in Fontconfig make zero sense to me.)

Third: I don’t even configure Fontconfig in home-manager, and I certainly don’t configure it to rely on Electron. And as mentioned, none of the relevant source files seem to ever mention Electron..? (Maybe something else at some point configures something Fontconfig-related, but in that case, why doesn’t that appear in the stack trace?)

I want to avoid just adding Electron to permittedInsecurePackages, because that feels like a problem waiting to happen, especially given that I have no idea where this dependency on Electron is even coming from.

Does anyone know anything about this? I’m so confused.

It’s not that Fontconfig itself depends on Electron; it’s that something enabled in your config is adding an Electron path to the Fontconfig settings. Can you post your HM configuration?

1 Like

bit too long to post verbatim, so here’s a link to the repo path:

(note: Besides the updated flake.lock, there is the singular uncommitted additional change of adding tor-browser to my home.packages. The errors persist regardless of whether it’s in there or not though, which is unsurprising, because it isn’t any sort of Electron app.)

..I do indeed have a few Electron apps, but looking at my current .config/fontconfig/conf.d/10-hm-fonts.conf (see below), that (at least currently) doesn’t result in any electron dependency. I’m going to try removing them one by one to see if I can perhaps narrow down the source of the error; will update.

10-hm-fonts.conf
<?xml version='1.0'?>

<!-- Generated by Home Manager. -->

<!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
<fontconfig>
<description>Add fonts in the Nix user profile</description>

<include ignore_missing="yes">/nix/store/qw5pbvrn0r7dxc972zbmggfnfl5zpymq-home-manager-path/etc/fonts/conf.d</include>
<include ignore_missing="yes">/nix/store/qw5pbvrn0r7dxc972zbmggfnfl5zpymq-home-manager-path/etc/fonts/fonts.conf</include>

<dir>/nix/store/qw5pbvrn0r7dxc972zbmggfnfl5zpymq-home-manager-path/lib/X11/fonts</dir>
<dir>/nix/store/qw5pbvrn0r7dxc972zbmggfnfl5zpymq-home-manager-path/share/fonts</dir>
<dir>/etc/profiles/per-user/flyxx/lib/X11/fonts</dir>
<dir>/etc/profiles/per-user/flyxx/share/fonts</dir>

<cachedir>/nix/store/qw5pbvrn0r7dxc972zbmggfnfl5zpymq-home-manager-path/lib/fontconfig/cache</cachedir>

</fontconfig>

ok well that was fast:

Literally my first try was to comment out vesktop, and the errors are gone. Sigh.

1 Like

There’s an open pull request to move Vesktop to a new version of Electron. Until that lands you can override the package in your own configuration:

# Use Electron 42 for Vesktop
    (final: prev: {
      vesktop = (prev.vesktop.override {
        electron_40 = final.electron_42;
      }).overrideAttrs (old: {
        preBuild = ''
          substituteInPlace package.json \
            --replace-fail '"electron": "^40.' '"electron": "^42.'
        '' + old.preBuild;
      });
    })
2 Likes

That looks like a nice solution. Will implement it for the time being until that PR makes it through. Thank you very much.

1 Like