nix: flatpak fonts & icons

This commit is contained in:
js0ny 2025-10-15 03:04:44 +01:00
parent 0c6d0edb42
commit af7c7b49f2
4 changed files with 57 additions and 40 deletions

View file

@ -3,7 +3,6 @@
pkgs, pkgs,
... ...
}: { }: {
security.pam.services.login.enableGnomeKeyring = true; security.pam.services.login.enableGnomeKeyring = true;
# Use latest kernel. # Use latest kernel.

View file

@ -2,8 +2,7 @@
pkgs, pkgs,
config, config,
... ...
}: }: let
let
fontPkgs = [ fontPkgs = [
pkgs.maple-mono.NF pkgs.maple-mono.NF
pkgs.sarasa-gothic pkgs.sarasa-gothic
@ -14,8 +13,7 @@ let
pkgs.noto-fonts-emoji pkgs.noto-fonts-emoji
pkgs.nerd-fonts.jetbrains-mono pkgs.nerd-fonts.jetbrains-mono
]; ];
in in {
{
environment.systemPackages = fontPkgs; environment.systemPackages = fontPkgs;
fonts = { fonts = {
@ -29,16 +27,15 @@ in
"Maple Mono NF" "Maple Mono NF"
"JetBrainsMono Nerd Font" "JetBrainsMono Nerd Font"
]; ];
serif = [ "LXGW WenKai" ]; serif = ["LXGW WenKai"];
sansSerif = [ "LXGW Neo XiHei" ]; sansSerif = ["LXGW Neo XiHei"];
}; };
}; };
fontDir.enable = true; fontDir.enable = true;
}; };
system.fsPackages = [ pkgs.bindfs ]; system.fsPackages = [pkgs.bindfs];
fileSystems = fileSystems = let
let
mkRoSymBind = path: { mkRoSymBind = path: {
device = path; device = path;
fsType = "fuse.bindfs"; fsType = "fuse.bindfs";
@ -50,7 +47,12 @@ in
}; };
aggregated = pkgs.buildEnv { aggregated = pkgs.buildEnv {
name = "system-fonts-and-icons"; name = "system-fonts-and-icons";
paths = fontPkgs; # with pkgs; [ paths =
fontPkgs
++ [
# Add cursor supports
pkgs.libsForQt5.breeze-qt5
]; # with pkgs; [
# libsForQt5.breeze-qt5 # libsForQt5.breeze-qt5
# noto-fonts # noto-fonts
@ -63,9 +65,7 @@ in
"/share/icons" "/share/icons"
]; ];
}; };
in in {
{
# Create an FHS mount to support flatpak host icons/fonts
"/usr/share/icons" = mkRoSymBind "${aggregated}/share/icons"; "/usr/share/icons" = mkRoSymBind "${aggregated}/share/icons";
"/usr/share/fonts" = mkRoSymBind "${aggregated}/share/fonts"; "/usr/share/fonts" = mkRoSymBind "${aggregated}/share/fonts";
}; };

View file

@ -9,5 +9,8 @@
tmux tmux
wl-clipboard wl-clipboard
nix-index nix-index
file
unzip
zip
]; ];
} }

View file

@ -1,5 +1,6 @@
# https://github.com/gmodena/nix-flatpak # https://github.com/gmodena/nix-flatpak
{...}: { {nix-flatpak, ...}: {
services.flatpak.enable = true;
services.flatpak.remotes = [ services.flatpak.remotes = [
{ {
name = "flathub"; name = "flathub";
@ -24,8 +25,22 @@
"com.getpostman.Postman" "com.getpostman.Postman"
]; ];
services.flatpak.overrides = { services.flatpak.overrides = {
global = {
Context = {
# Force wayland by default
sockets = ["wayland" "!x11" "!fallback-x11"];
filesystems = [
"/run/current-system/sw/share/fonts:ro"
"xdg-config/fontconfig:ro"
# "xdg-data/fonts:ro"
];
};
};
"com.qq.QQ".Context.sockets = ["x11"];
"com.tencent.WeChat" = { "com.tencent.WeChat" = {
Context.sockets = ["x11"];
Environment = { Environment = {
# WeChat does not support wayland & wayland-ime
QT_IM_MODULE = "fcitx"; QT_IM_MODULE = "fcitx";
}; };
}; };