fix fonts for flatpaks
This commit is contained in:
44
plasma.nix
44
plasma.nix
@@ -20,4 +20,48 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
pulse.enable = true;
|
pulse.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
system.fsPackages = [ pkgs.bindfs ];
|
||||||
|
fileSystems = let
|
||||||
|
mkRoSymBind = path: {
|
||||||
|
device = path;
|
||||||
|
fsType = "fuse.bindfs";
|
||||||
|
options = [ "ro" "resolve-symlinks" "x-gvfs-hide" ];
|
||||||
|
};
|
||||||
|
fontsPkgs = config.fonts.packages;
|
||||||
|
x11Fonts = pkgs.runCommand "X11-fonts"
|
||||||
|
{
|
||||||
|
preferLocalBuild = true;
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
gzip
|
||||||
|
xorg.mkfontscale
|
||||||
|
xorg.mkfontdir
|
||||||
|
];
|
||||||
|
}
|
||||||
|
(''
|
||||||
|
mkdir -p "$out/share/fonts"
|
||||||
|
font_regexp='.*\.\(ttf\|ttc\|otb\|otf\|pcf\|pfa\|pfb\|bdf\)\(\.gz\)?'
|
||||||
|
''
|
||||||
|
+ (builtins.concatStringsSep "\n" (builtins.map (pkg: ''
|
||||||
|
find ${toString pkg} -regex "$font_regexp" \
|
||||||
|
-exec ln -sf -t "$out/share/fonts" '{}' \;
|
||||||
|
'') fontsPkgs
|
||||||
|
))
|
||||||
|
+ ''
|
||||||
|
cd "$out/share/fonts"
|
||||||
|
mkfontscale
|
||||||
|
mkfontdir
|
||||||
|
cat $(find ${pkgs.xorg.fontalias}/ -name fonts.alias) >fonts.alias
|
||||||
|
'');
|
||||||
|
aggregatedIcons = pkgs.buildEnv {
|
||||||
|
name = "system-icons";
|
||||||
|
paths = fontsPkgs;
|
||||||
|
pathsToLink = [
|
||||||
|
"/share/icons"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
"/usr/share/icons" = mkRoSymBind (aggregatedIcons + "/share/icons");
|
||||||
|
"/usr/share/fonts" = mkRoSymBind (x11Fonts + "/share/fonts");
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user