From c686798ddbf3ab11d72a997a1ee336f3d93a61b8 Mon Sep 17 00:00:00 2001 From: lucannez64 <58551020+lucannez64@users.noreply.github.com> Date: Tue, 20 Oct 2026 13:57:05 +0200 Subject: [PATCH] test(nix): run font compatibility regressions in CI --- .github/workflows/source-check.yml | 2 ++ docs/NIX.md | 7 ++++--- flake.nix | 2 ++ tests/test_nix_fonts.py | 6 +++--- tests/test_nix_repairs.py | 3 ++- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/source-check.yml b/.github/workflows/source-check.yml index c068e01..3e91493 100644 --- a/.github/workflows/source-check.yml +++ b/.github/workflows/source-check.yml @@ -21,6 +21,8 @@ jobs: - run: python tools/riot-launcher-offline-check.py - run: python tools/riot-runtime-cleanup-offline-check.py - run: python tools/riot-cdn-dns-offline-check.py + - run: python -m unittest discover -s tests -p 'test_nix_fonts.py' + - run: python -m unittest discover -s tests -p 'test_nix_repairs.py' - run: python -m unittest discover -s tests -p 'test_hidden_riot_recovery.py' - run: python -m unittest discover -s tests -p 'test_desktop_run.py' - run: python -m unittest discover -s tests -p 'test_urlsession_runner.py' diff --git a/docs/NIX.md b/docs/NIX.md index 05910c8..2cde500 100644 --- a/docs/NIX.md +++ b/docs/NIX.md @@ -215,9 +215,10 @@ the host's `/usr/share/fonts`, which the FHS environment replaces. Fonts in your user font directories remain available. This also prevents an icon-only user font inventory from becoming the only fallback for ordinary text. -Inherited `FONTCONFIG_PATH` and `FONTCONFIG_SYSROOT` overrides are cleared inside -the FHS environment so foreign include paths or an invalid sysroot cannot hide -the packaged fonts. Custom XDG font/configuration directories and legacy +The FHS environment selects the packaged fontconfig configuration and clears +inherited `FONTCONFIG_PATH` and `FONTCONFIG_SYSROOT` overrides. Clearing the +sysroot prevents it from redirecting the packaged configuration and font paths. +Custom XDG font/configuration directories and legacy `~/.fonts` remain supported, including paths with spaces. The host configuration and user font files are not modified. diff --git a/flake.nix b/flake.nix index f071941..ef8a7b5 100644 --- a/flake.nix +++ b/flake.nix @@ -19,6 +19,8 @@ fontDirectories = darlingFonts; includes = [ "${pkgs.fontconfig.out}/etc/fonts/conf.d" + # makeFontsConf adds XDG font directories, but neither it nor + # conf.d/50-user.conf adds the legacy ~/.fonts directory. (pkgs.writeText "darling-user-fonts.conf" '' ~/.fonts diff --git a/tests/test_nix_fonts.py b/tests/test_nix_fonts.py index ac0e5ae..4562268 100644 --- a/tests/test_nix_fonts.py +++ b/tests/test_nix_fonts.py @@ -88,9 +88,9 @@ class NixFontsConfigTest(unittest.TestCase): self.assertNotIn("FONTCONFIG_SYSROOT", resulting_env) self.assertNotIn("FONTCONFIG_PATH", resulting_env) - self.assertTrue( - resulting_env.get("FONTCONFIG_FILE", "").startswith("/nix/store/"), - f"Unexpected FONTCONFIG_FILE: {resulting_env.get('FONTCONFIG_FILE')}", + self.assertEqual( + resulting_env.get("FONTCONFIG_FILE"), + "/nix/store/mock-darlingFontsConf", ) self.assertEqual(resulting_env.get("XDG_DATA_HOME"), "/tmp/mock-xdg data with spaces") self.assertEqual(resulting_env.get("XDG_CONFIG_HOME"), "/tmp/mock-xdg config with spaces") diff --git a/tests/test_nix_repairs.py b/tests/test_nix_repairs.py index 09ebb58..49e232f 100644 --- a/tests/test_nix_repairs.py +++ b/tests/test_nix_repairs.py @@ -454,7 +454,8 @@ class SessionTests(unittest.TestCase): self.assertIn('terminal', result.stderr.lower()) self.assertFalse((root / 'build').exists()) self.assertIn('Terminal=true', (ROOT / 'flake.nix').read_text()) - self.assertIn('checks.${system}', (ROOT / 'flake.nix').read_text()) + self.assertIn('packaging = pkgs.runCommand "darling-lol-packaging-tests"', + (ROOT / 'flake.nix').read_text()) def test_rootless_update_refuses_live_marker_without_build_or_stop(self): with tempfile.TemporaryDirectory(prefix='nix-update-idle-') as directory: