Files
nix/modules/home/xdg/default.nix

51 lines
1.7 KiB
Nix

# XDG stands for "Cross-Desktop Group", with X used to mean "cross".
# It's a bunch of specifications from freedesktop.org intended to standardize desktops and
# other GUI applications on various systems (primarily Unix-like) to be interoperable:
# https://www.freedesktop.org/wiki/Specifications/
{ config, pkgs, ... }: {
home.packages = with pkgs; [
xdg-utils # provides cli tools such as `xdg-mime` `xdg-open`
xdg-user-dirs
];
xdg = {
enable = true;
cacheHome = config.home.homeDirectory + "/.cache";
systemDirs = {
data = [
"${config.home.homeDirectory}/.local/share/flatpak/exports/share"
"/var/lib/flatpak/exports/share"
];
};
userDirs = {
enable = true;
createDirectories = false;
documents = config.home.homeDirectory + "/doc";
music = config.home.homeDirectory + "/doc/music";
desktop = config.home.homeDirectory + "/tmp";
download = config.home.homeDirectory + "/tmp";
videos = config.home.homeDirectory + "/tmp";
pictures = config.home.homeDirectory + "/tmp";
# templates = config.home.homeDirectory + "/tmp";
# publicShare = config.home.homeDirectory + "/tmp";
extraConfig = {
XDG_SCREENSHOTS_DIR = config.home.homeDirectory + "/tmp/Screenshots";
};
};
};
# 使用map函数循环 conf 变量,动态的生成 home.file.<user>.config.${i}
xdg.configFile = builtins.listToAttrs
(builtins.map
(name: {
inherit name;
value = {
source = config.home-libs.mkOutOfStoreSymlink "modules/home/xdg/conf/${name}";
};
})
(builtins.attrNames (builtins.readDir ./conf))
);
}