<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title>grop.dev</title><id>https://grop.dev/feeds/tags/nix.xml</id><subtitle>Tag: nix</subtitle><updated>2026-10-03T11:42:51Z</updated><link href="https://grop.dev/feeds/tags/nix.xml" rel="self" /><link href="https://grop.dev" /><entry><title>Fontconfig problems with Nix on Guix System</title><id>https://grop.dev/posts/fontconfig-problems-with-nix-on-guix-system.html</id><author><name>Gunnar Grop</name><email>gunnar.grop@protonmail.com</email></author><updated>2026-07-20T16:49:00Z</updated><link href="https://grop.dev/posts/fontconfig-problems-with-nix-on-guix-system.html" rel="alternate" /><content type="html">&lt;p&gt;Since I started using &lt;a href=&quot;https://guix.gnu.org/&quot;&gt;Guix System&lt;/a&gt; about a year ago, I've absolutely loved it.
I can easily say it's my favourite OS out of any I've used, thus far.
Although, compared to &lt;a href=&quot;https://nixos.org/&quot;&gt;Nix&lt;/a&gt; (which Guix is based on), it has comparatively few software packages packaged for it.
This is no wonder when considering the &lt;a href=&quot;https://search.nixos.org/packages&quot;&gt;sheer amount of packages&lt;/a&gt; for Nix.&lt;/p&gt;&lt;p&gt;Fortunately this &amp;quot;problem&amp;quot; is easily remedied by just using Nix on Guix System! This is made
extra easy by using the system service &lt;code&gt;nix-service-type&lt;/code&gt; (&lt;a href=&quot;https://guix.gnu.org/manual/1.5.0/en/html_node/Miscellaneous-Services.html&quot;&gt;documentation&lt;/a&gt;).&lt;/p&gt;&lt;p&gt;Now I use Nix on Guix System, mostly using &lt;a href=&quot;https://github.com/nix-community/home-manager&quot;&gt;Home Manager&lt;/a&gt;, and for the most parts it works great.
One of the few problems I've run into is that graphical programs installed via Nix get the wrong fonts,
like they couldn't find any fonts and always used a fallback. In this case, &lt;a href=&quot;https://typeof.net/Iosevka/&quot;&gt;Iosevka&lt;/a&gt;, which I had installed
with Guix. No matter which font packages I installed, every application would use Iosevka.&lt;/p&gt;&lt;p&gt;For example, Firefox (installed via Nix) would log this error whenever started:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Fontconfig error: Cannot load default config file: File not found:&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Turns out that this is a problem with &lt;a href=&quot;https://www.freedesktop.org/wiki/Software/fontconfig/?__goaway_challenge=meta-refresh&amp;amp;__goaway_id=7c20e24f4a4272237f29befdc44945e6&amp;amp;__goaway_referer=https%3A%2F%2Fnoai.duckduckgo.com%2F&quot;&gt;Fontconfig&lt;/a&gt;. Or rather, that Guix and Nix manages their Fontconfig configs
differently. Guix System does not set the environment variables &lt;code&gt;FONTCONFIG_FILE&lt;/code&gt; or &lt;code&gt;FONTCONFIG_PATH&lt;/code&gt;,
which are used by Fontconfig to figure out where configurations are placed. By default, Fontconfig looks
in the directory &lt;code&gt;/etc/fonts&lt;/code&gt; to find fonts and configs, but this is not where Guix places them. Guix instead
places font configuration in the active system configuration directory, under &lt;code&gt;/run/current-system/profile&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;So, to fix the font problems with Nix applications, all we have to do is to set the following environment variables:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;FONTCONFIG_PATH=/run/current-system/profile/etc/fonts
FONTCONFIG_FILE=/run/current-system/profile/etc/fonts/fonts.conf&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In my case, I opted to do this in my Guix Home configuration, using the &lt;code&gt;home-bash-service-type&lt;/code&gt; service, like so:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;home-environment&lt;/span&gt;
 &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;services&lt;/span&gt;
  &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;append&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;home-bash-service-type&lt;/span&gt;
                         &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;home-bash-configuration&lt;/span&gt;
                          &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-symbol&quot;&gt;environment-variables&lt;/span&gt;
                           &lt;span class=&quot;syntax-symbol&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;FONTCONFIG_FILE&amp;quot;&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;/run/current-system/profile/etc/fonts/fonts.conf&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                             &lt;span class=&quot;syntax-open&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;FONTCONFIG_PATH&amp;quot;&lt;/span&gt; &lt;span class=&quot;syntax-symbol&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;syntax-string&quot;&gt;&amp;quot;/run/current-system/profile/etc/fonts&amp;quot;&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;
          &lt;span class=&quot;syntax-symbol&quot;&gt;%base-home-services&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;syntax-close&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;But you can set them however you like.
After the environment variables are set, applications installed with Nix should find your installed fonts.&lt;/p&gt;</content></entry><entry><title>NixOS WSL on Corporate Networks</title><id>https://grop.dev/posts/nixos-wsl-on-corporate-networks.html</id><author><name>Gunnar Grop</name><email>gunnar.grop@protonmail.com</email></author><updated>2026-05-03T20:49:00Z</updated><link href="https://grop.dev/posts/nixos-wsl-on-corporate-networks.html" rel="alternate" /><content type="html">&lt;h2&gt;Abstract&lt;/h2&gt;&lt;p&gt;Last year I started exclusively using &lt;a href=&quot;https://guix.gnu.org/&quot;&gt;Guix System&lt;/a&gt; on my personal computers and fell in love with it.
Since then I've started to grow a bit &amp;quot;bored&amp;quot; with more traditional GNU/Linux system, and whenever I have to use one
I quickly start missing the declarative nature of configuring guix/nix systems.&lt;/p&gt;&lt;p&gt;Until very recently I've been stuck using openSUSE Tumbleweed via WSL2 on my work laptop (since I have no option for
anything other than Windows). It's worked well and I still think Tumbleweed is a great distro, but like I said,
I was just a bit bored of it.&lt;/p&gt;&lt;p&gt;At first I obviosuly looked into using Guix System on WSL2, which is possible via the &amp;quot;WSL2&amp;quot; image type that guix offers.
But, I deemed it a bit of a hassle, mostly because there are no pre-built images available.
If you didn't know, you can see available image types by running:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;guix system image --list-image-types&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Anyway, around the same time I saw that there are community built WSL2 NixOS images available via the &lt;a href=&quot;https://github.com/nix-community/NixOS-WSL&quot;&gt;NixOS-WSL&lt;/a&gt; project.
Not only that, but they also provide WSL-related &lt;a href=&quot;https://nix-community.github.io/NixOS-WSL/options.html&quot;&gt;configuration options&lt;/a&gt; for NixOS. So, this was the easier starting point.
I think most of my colleagues would be more interested in Nix over Guix, anyhow.&lt;/p&gt;&lt;h2&gt;Challanges&lt;/h2&gt;&lt;p&gt;The main challanges on my corporate network are these:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;A corporate HTTP proxy for all outgoing traffic.&lt;/li&gt;&lt;li&gt;The proxy handles authentication via &lt;a href=&quot;https://en.wikipedia.org/wiki/NTLM&quot;&gt;NTLM&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;The proxy serves a TLS certificate signed by an in-house &lt;a href=&quot;https://en.wikipedia.org/wiki/Certificate_authority&quot;&gt;CA&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;Installation&lt;/h2&gt;&lt;h3&gt;The Proxy&lt;/h3&gt;&lt;p&gt;First of all, setting &lt;code&gt;HTTP_PROXY&lt;/code&gt; and &lt;code&gt;HTTPS_PROXY&lt;/code&gt; in Linux, as per usual, doesn't work very well with &lt;a href=&quot;https://en.wikipedia.org/wiki/NTLM&quot;&gt;NTLM&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;To get around this I installed a proxy on the Windows host that handle authentication with the upstream proxy, then
I just use that one via &lt;code&gt;HTTP_PROXY&lt;/code&gt; and &lt;code&gt;HTTPS_PROXY&lt;/code&gt; in Linux.&lt;/p&gt;&lt;p&gt;My proxy of choice is &lt;a href=&quot;https://github.com/genotrance/px&quot;&gt;Px&lt;/a&gt;, because it's very easy to setup. We just need to &lt;a href=&quot;https://github.com/genotrance/px/releases&quot;&gt;download it&lt;/a&gt; and change one line in the config file (px.ini).&lt;/p&gt;&lt;pre&gt;&lt;code&gt;[proxy]

; NTLM server(s) to connect through. IP:port, hostname:port
;   Multiple proxies can be specified comma separated. Px will iterate through
;   and use the one that works
server = http://proxy.example.com:8080

...&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then start it with:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;.\px.exe&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now Px should be running and is listening on the default host and port.&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;a href=&quot;http://127.0.0.1:3128&quot;&gt;http://127.0.0.1:3128&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;h3&gt;Install NixOS&lt;/h3&gt;&lt;ol&gt;&lt;li&gt;Download the latest &lt;a href=&quot;https://github.com/nix-community/NixOS-WSL/releases/latest&quot;&gt;release image of NixOS-WSL&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;p&gt;Install the image with:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;wsl --install --from-file nixos.wsl&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Start NixOS with:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;wsl -d NixOS&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Now that NixOS is started we can finally start configuring it.&lt;/p&gt;&lt;p&gt;We'll start by (temporarily) telling NixOS to use our proxy (&lt;a href=&quot;https://nlewo.github.io/nixos-manual-sphinx/installation/installing-behind-a-proxy.xml.html&quot;&gt;documentation&lt;/a&gt;).&lt;/p&gt;&lt;pre&gt;&lt;code&gt;# Set HTTP proxy to the Px proxy we installed earlier
proxy_url=&amp;quot;http://localhost:3128/&amp;quot;
export http_proxy=&amp;quot;$proxy_url&amp;quot;
export HTTP_PROXY=&amp;quot;$proxy_url&amp;quot;
export https_proxy=&amp;quot;$proxy_url&amp;quot;
export HTTPS_PROXY=&amp;quot;$proxy_url&amp;quot;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Before continuing, you'll need to check if your upstream corporate HTTP proxy serves a custom TLS certificate.
This can easily be done by just checking if you get any SSL/TLS issues when requesting a regular website.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;curl https://duckduckgo.com&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you get any errors with the previous command, you'll have to fetch a copy of whatever public CA certificate is used to trust
your proxy's TLS certificate.&lt;/p&gt;&lt;p&gt;From here I'll assume you have all CA certificates you need in a file called &lt;code&gt;ca.pem&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;Now we need to update NixOS.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;# Let's temporarily trust our CA certificate
# https://nix.dev/manual/nix/2.28/installation/env-variables.html?highlight=certi#nix_ssl_cert_file
export NIX_SSL_CERT_FILE=/path/to/ca.pem

# Update NixOS
# We'll use 'sudo -E' to preserve the environment variables we just set
sudo -E nix-channel -v --update&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: If your upstream proxy has any kind of malware scanning (like mine does), the update can potentially take a very long time.
For me it took about ~60 minutes.&lt;/p&gt;&lt;h3&gt;Configure NixOS&lt;/h3&gt;&lt;p&gt;Now it's time to configure NixOS for real. I'll provide you with a simple NixOS and home-manager configuration that you can build
upon later.&lt;/p&gt;&lt;p&gt;I've based these configs on the excellent minimal &lt;a href=&quot;https://github.com/Misterio77/nix-starter-configs&quot;&gt;nix-starter-config&lt;/a&gt; provided by &lt;a href=&quot;https://github.com/Misterio77&quot;&gt;Misterio77&lt;/a&gt; on GitHub.&lt;/p&gt;&lt;p&gt;The structure:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;.
├── flake.nix              # The &amp;quot;init&amp;quot; file
├── home-manager
│   └── home.nix           # Home configuration
└── nixos
    └── configuration.nix  # System configuration&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I'll assume the hostname is &lt;code&gt;nixos&lt;/code&gt; and the user account is &lt;code&gt;nixos&lt;/code&gt;, which are both default in NixOS-WSL.&lt;/p&gt;&lt;p&gt;&lt;em&gt;flake.nix&lt;/em&gt;:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;{
  description = &amp;quot;NixOS config for WSL2&amp;quot;;

  inputs = {
    # Nixpkgs
    nixpkgs.url = &amp;quot;github:nixos/nixpkgs/nixos-25.11&amp;quot;;

    # NixOS WSL
    nixos-wsl.url = &amp;quot;github:nix-community/NixOS-WSL/main&amp;quot;;

    # Home manager
    home-manager.url = &amp;quot;github:nix-community/home-manager/release-25.11&amp;quot;;
    home-manager.inputs.nixpkgs.follows = &amp;quot;nixpkgs&amp;quot;;
  };

  outputs = {
    self,
      nixpkgs,
      nixos-wsl,
      home-manager,
      ...
  } @ inputs: let
  in {
    # NixOS configuration entrypoint
    # Available through 'nixos-rebuild --flake .#nixos'
    nixosConfigurations = {
      nixos = nixpkgs.lib.nixosSystem {
        system = &amp;quot;x86_64-linux&amp;quot;;
        specialArgs = {inherit inputs;};
        modules = [
          ./nixos/configuration.nix
          nixos-wsl.nixosModules.default
          {
            system.stateVersion = &amp;quot;25.11&amp;quot;;
            wsl.enable = true;
          }
        ];
      };
    };

    # Standalone home-manager configuration entrypoint
    # Available through 'home-manager --flake .#nixos@nixos'
    homeConfigurations = {
      &amp;quot;nixos@nixos&amp;quot; = home-manager.lib.homeManagerConfiguration {
        # Home-manager requires 'pkgs' instance
        pkgs = nixpkgs.legacyPackages.x86_64-linux; # FIXME replace x86_64-linux with your architecture
        extraSpecialArgs = {inherit inputs;};
        modules = [./home-manager/home.nix];
      };
    };
  };
}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;em&gt;home.nix&lt;/em&gt;:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;# This is your home-manager configuration file
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
{
  inputs,
  lib,
  config,
  pkgs,
  ...
}: {
  nixpkgs = {
    config = {
      # Disable if you don't want unfree packages
      allowUnfree = true;
    };
  };

  home = {
    username = &amp;quot;nixos&amp;quot;;
    homeDirectory = &amp;quot;/home/nixos&amp;quot;;
  };

  programs.home-manager.enable = true;

  # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
  home.stateVersion = &amp;quot;25.11&amp;quot;;
}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;em&gt;configuration.nix&lt;/em&gt;:&lt;/p&gt;&lt;pre&gt;&lt;code&gt;# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).

# NixOS-WSL specific options are documented on the NixOS-WSL repository:
# https://github.com/nix-community/NixOS-WSL

{ config, lib, pkgs, ... }:

{
  wsl.enable = true;
  wsl.defaultUser = &amp;quot;nixos&amp;quot;;
  wsl.startMenuLaunchers = true;

  nix.settings.experimental-features = [ &amp;quot;nix-command&amp;quot; &amp;quot;flakes&amp;quot; ];

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It's perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = &amp;quot;25.11&amp;quot;; # Did you read the comment?

  networking.proxy.default = &amp;quot;http://127.0.0.1:3128&amp;quot;;
  # FIXME replace with your actual no_proxy settings
  networking.proxy.noProxy = &amp;quot;localhost,127.0.0.1,mycompany.com&amp;quot;;

  security.pki.certificates = [
    # FIXME replace with your actual company CA certificate
    # The certificate(s) for your corporate proxy
    ''
      -----BEGIN CERTIFICATE-----
      ...
      -----END CERTIFICATE-----
    ''
  ];
}&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now that we have the configuration files we can configure evertyhing.
I'll assume your configuration files are in a directory called &lt;code&gt;/home/nixos/.dotfiles&lt;/code&gt;, with the exact directory structure I showed above.&lt;/p&gt;&lt;pre&gt;&lt;code&gt;# We'll enable experimental nix features (only needs doing once)
export NIX_CONFIG=&amp;quot;experimental-features = nix-command flakes&amp;quot;

# Configure the system
sudo -E nixos-rebuild switch --flake /home/nixos/.dotfiles#nixos

# Bootstrap home-manager (only needs doing once)
nix shell nixpkgs#home-manager

# Configure home
home-manager switch --flake /home/nixos/.dotfiles#nixos@nixos&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Alright, now it's all done! Assuming you correctly setup the proxy config and TLS config in &lt;code&gt;configuration.nix&lt;/code&gt;, you should now have a working NixOS container in WSL.
In the future you can just build upon &lt;code&gt;configuration.nix&lt;/code&gt; and &lt;code&gt;home.nix&lt;/code&gt; for further configuration.
You should also preferably put everything in a version controlled git repository, for safe-keeping.&lt;/p&gt;&lt;h2&gt;Conclusion&lt;/h2&gt;&lt;p&gt;As you can see, and depending on your companys networking, it's not just plug-and-play with NixOS for WSL.
But, it's not exactly rocket science either.&lt;/p&gt;&lt;p&gt;I've been using NixOS on WSL based on this setup for a while now, and I love using it.&lt;/p&gt;&lt;p&gt;Of course, I would still want to try out Guix System for WSL as well, but it looks like it's a fair amount of extra work to get it working.
Mostly because I'll have to write a working config (proxy/TLS and all that) and then build an image based on it before I can even install it in WSL.
But that will probably be a future blog post. 🙂&lt;/p&gt;&lt;p&gt;Enjoy NixOS!&lt;/p&gt;</content></entry></feed>