From 0517d0e8dfc2330b90e60ef131342b11c8fed5f0 Mon Sep 17 00:00:00 2001 From: ryan4yin Date: Sun, 14 May 2023 18:22:33 +0800 Subject: [PATCH] feat: add flatpack to install apps not supported well in NixOS --- modules/fhs-fonts.nix | 25 +++++++++++++++++++++++++ modules/nur-packages.nix | 3 ++- modules/system.nix | 3 +++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 modules/fhs-fonts.nix diff --git a/modules/fhs-fonts.nix b/modules/fhs-fonts.nix new file mode 100644 index 00000000..f7fcb3e5 --- /dev/null +++ b/modules/fhs-fonts.nix @@ -0,0 +1,25 @@ +# copy from https://github.com/NixOS/nixpkgs/issues/119433#issuecomment-1326957279 +# mainly for flatpak +# bindfs resolves all symlink, allowing all fonts to be accessed at /usr/share/fonts, without letting /nix into the sandbox. + +{ config, pkgs, ... }: + +{ + system.fsPackages = [ pkgs.bindfs ]; + fileSystems = let + mkRoSymBind = path: { + device = path; + fsType = "fuse.bindfs"; + options = [ "ro" "resolve-symlinks" "x-gvfs-hide" ]; + }; + aggregatedFonts = pkgs.buildEnv { + name = "system-fonts"; + paths = config.fonts.fonts; + pathsToLink = [ "/share/fonts" ]; + }; + in { + # Create an FHS mount to support flatpak host icons/fonts + "/usr/share/icons" = mkRoSymBind (config.system.path + "/share/icons"); + "/usr/share/fonts" = mkRoSymBind (aggregatedFonts + "/share/fonts"); + }; +} \ No newline at end of file diff --git a/modules/nur-packages.nix b/modules/nur-packages.nix index aaeae464..b6391da9 100644 --- a/modules/nur-packages.nix +++ b/modules/nur-packages.nix @@ -8,6 +8,7 @@ environment.systemPackages = with config.nur.repos.xddxdd; [ # packages from nur-xddxdd wechat-uos - qqmusic ]; + + # flatpack is recommended to install other apps such as netease-cloud-music/qqmusic/... } \ No newline at end of file diff --git a/modules/system.nix b/modules/system.nix index 71bed5f6..5a66e7ff 100644 --- a/modules/system.nix +++ b/modules/system.nix @@ -153,6 +153,9 @@ sound.enable = true; hardware.pulseaudio.enable = false; + # https://flatpak.org/setup/NixOS + services.flatpak.enable = true; + # security with polkit services.power-profiles-daemon = { enable = true;