diff --git a/system/fontdir.nix b/system/fontdir.nix new file mode 100644 index 00000000000..05aa67232ed --- /dev/null +++ b/system/fontdir.nix @@ -0,0 +1,20 @@ +args: + with args; +stdenv.mkDerivation +{ + name="X11-fonts"; + phases="installPhase"; + fontDirs = import ./fonts.nix {inherit pkgs config;}; + installPhase = " + mkdir -p \$out/share/X11-fonts/; + for i in \$fontDirs; do + if ! echo \$i | egrep '~|/nix/var/nix/profiles' &>/dev/null; then + j=\${i#/nix/store/} + j=\${j%%/*} + if ! test -e \$out/share/X11-fonts/\${g}; then + ln -s \$i \$out/share/X11-fonts/\${j}; + fi; + fi; + done; + "; +} diff --git a/system/options.nix b/system/options.nix index 4da6eb290a9..33e2fd87dbe 100644 --- a/system/options.nix +++ b/system/options.nix @@ -1130,6 +1130,15 @@ root ALL=(ALL) SETENV: ALL applications. "; } + { + name=["fonts" "enableFontDir"]; + default = false; + description = " + Whether to create a directory with links to all fonts in share - + so user can configure vncserver script one time (I mean per-user + vncserver, so global service is not a good solution). +"; + } { name = ["fonts" "extraFonts"]; diff --git a/system/system.nix b/system/system.nix index 05e131f5dcd..2f18bc327e6 100644 --- a/system/system.nix +++ b/system/system.nix @@ -162,6 +162,11 @@ rec { extraEtc = pkgs.lib.concatLists (map (job: job.extraEtc) upstartJobs.jobs); }; + # Font aggregation + fontDir = import ./fontdir.nix { + inherit (pkgs) stdenv; + inherit pkgs config; + }; # The wrapper setuid programs (since we can't have setuid programs # in the Nix store). @@ -322,6 +327,8 @@ rec { inherit activateConfiguration; inherit grubMenuBuilder; inherit etc; + fontDir = (if config.get ["fonts" "enableFontDir"] then + fontDir else null); inherit systemPath; kernel = kernel + "/vmlinuz"; initrd = initialRamdisk + "/initrd";