fix bug
This commit is contained in:
@@ -1,18 +1,6 @@
|
|||||||
{
|
{ config, lib, pkgs, ... }:
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
###################################################################################
|
|
||||||
#
|
|
||||||
# Copy from https://github.com/NixOS/nixpkgs/issues/119433#issuecomment-1326957279
|
|
||||||
# Mainly for flatpak
|
|
||||||
# 1. bindfs resolves all symlink,
|
|
||||||
# 2. allowing all fonts to be accessed at `/usr/share/fonts`
|
|
||||||
# 3. without letting /nix into the sandbox.
|
|
||||||
#
|
|
||||||
###################################################################################
|
|
||||||
|
|
||||||
|
{
|
||||||
system.fsPackages = [ pkgs.bindfs ];
|
system.fsPackages = [ pkgs.bindfs ];
|
||||||
fileSystems = let
|
fileSystems = let
|
||||||
mkRoSymBind = path: {
|
mkRoSymBind = path: {
|
||||||
@@ -20,14 +8,20 @@
|
|||||||
fsType = "fuse.bindfs";
|
fsType = "fuse.bindfs";
|
||||||
options = [ "ro" "resolve-symlinks" "x-gvfs-hide" ];
|
options = [ "ro" "resolve-symlinks" "x-gvfs-hide" ];
|
||||||
};
|
};
|
||||||
aggregatedFonts = pkgs.buildEnv {
|
# 修改聚合字体的方式
|
||||||
|
aggregatedFonts = pkgs.symlinkJoin {
|
||||||
name = "system-fonts";
|
name = "system-fonts";
|
||||||
paths = config.fonts.fonts;
|
paths = config.fonts.fonts;
|
||||||
pathsToLink = ["/share/fonts"];
|
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
# Create an FHS mount to support flatpak host icons/fonts
|
# 修改挂载点的路径和配置
|
||||||
"/usr/share/icons" = mkRoSymBind (config.system.path + "/share/icons");
|
"/usr/share/icons" = mkRoSymBind "${config.system.path}/share/icons";
|
||||||
"/usr/share/fonts" = mkRoSymBind (aggregatedFonts + "/share/fonts");
|
"/usr/share/fonts" = mkRoSymBind "${aggregatedFonts}/share/fonts";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# 确保目录存在
|
||||||
|
system.activationScripts.makeFontsDirectory = ''
|
||||||
|
mkdir -p /usr/share/fonts
|
||||||
|
mkdir -p /usr/share/icons
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user