From 179ce0aacf11a84a840d4ddc94c3b09ac7b0eb6c Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Sun, 3 Oct 2021 23:03:26 +0200 Subject: [PATCH] fontconfig: use a prettier "real directory" hack --- modules/misc/fontconfig.nix | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/modules/misc/fontconfig.nix b/modules/misc/fontconfig.nix index 795ab3a74..82d973e2b 100644 --- a/modules/misc/fontconfig.nix +++ b/modules/misc/fontconfig.nix @@ -36,22 +36,11 @@ in { }; config = mkIf cfg.enable { - # Create two dummy files in /lib/fontconfig to make sure that - # buildEnv creates a real directory path. These files are removed - # in home.extraProfileCommands below so the packages will not - # become "runtime" dependencies. home.packages = [ - (pkgs.writeTextFile { - name = "hm-dummy1"; - destination = "/lib/fontconfig/hm-dummy1"; - text = "dummy"; - }) - - (pkgs.writeTextFile { - name = "hm-dummy2"; - destination = "/lib/fontconfig/hm-dummy2"; - text = "dummy"; - }) + # Make sure that buildEnv creates a real directory path so that we avoid + # trying to write to a read-only location. + (pkgs.runCommandLocal "dummy-fc-dir1" { } "mkdir -p $out/lib/fontconfig") + (pkgs.runCommandLocal "dummy-fc-dir2" { } "mkdir -p $out/lib/fontconfig") ]; home.extraProfileCommands = '' @@ -76,8 +65,7 @@ in { unset FONTCONFIG_FILE fi - # Remove hacky dummy files. - rm $out/lib/fontconfig/hm-dummy? + # Remove the fontconfig directory if no files were available. rmdir --ignore-fail-on-non-empty -p $out/lib/fontconfig '';