aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/misc/xdg-user-dirs.nix
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2019-10-05 12:06:29 +0000
committerKatharina Fey <kookie@spacekookie.de>2019-10-05 12:42:50 +0000
commit1148b1d122bc03e9a3665856c9b7bb96bd4e3994 (patch)
tree1a9586de593790e236349d5caa0abdff7f3f6856 /home-manager/modules/misc/xdg-user-dirs.nix
parent919d4e75699aa4ba456fd2d3d416a0522c9c7294 (diff)
parent8bddc1adab0f7a51476f819fa2197353e8e1d136 (diff)
Add 'home-manager/' from commit '8bddc1adab0f7a51476f819fa2197353e8e1d136'
git-subtree-dir: home-manager git-subtree-mainline: 919d4e75699aa4ba456fd2d3d416a0522c9c7294 git-subtree-split: 8bddc1adab0f7a51476f819fa2197353e8e1d136
Diffstat (limited to 'home-manager/modules/misc/xdg-user-dirs.nix')
-rw-r--r--home-manager/modules/misc/xdg-user-dirs.nix100
1 files changed, 100 insertions, 0 deletions
diff --git a/home-manager/modules/misc/xdg-user-dirs.nix b/home-manager/modules/misc/xdg-user-dirs.nix
new file mode 100644
index 00000000000..4d034d7fe43
--- /dev/null
+++ b/home-manager/modules/misc/xdg-user-dirs.nix
@@ -0,0 +1,100 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.xdg.userDirs;
+
+in
+
+{
+ meta.maintainers = with maintainers; [ pacien ];
+
+ options.xdg.userDirs = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to manage <filename>$XDG_CONFIG_HOME/user-dirs.dirs</filename>.
+ </para>
+ <para>
+ The generated file is read-only.
+ '';
+ };
+
+ # Well-known directory list from
+ # https://gitlab.freedesktop.org/xdg/xdg-user-dirs/blob/master/man/user-dirs.dirs.xml
+
+ desktop = mkOption {
+ type = types.str;
+ default = "$HOME/Desktop";
+ description = "The Desktop directory.";
+ };
+
+ documents = mkOption {
+ type = types.str;
+ default = "$HOME/Documents";
+ description = "The Documents directory.";
+ };
+
+ download = mkOption {
+ type = types.str;
+ default = "$HOME/Downloads";
+ description = "The Downloads directory.";
+ };
+
+ music = mkOption {
+ type = types.str;
+ default = "$HOME/Music";
+ description = "The Music directory.";
+ };
+
+ pictures = mkOption {
+ type = types.str;
+ default = "$HOME/Pictures";
+ description = "The Pictures directory.";
+ };
+
+ publishShare = mkOption {
+ type = types.str;
+ default = "$HOME/Public";
+ description = "The Public share directory.";
+ };
+
+ templates = mkOption {
+ type = types.str;
+ default = "$HOME/Templates";
+ description = "The Templates directory.";
+ };
+
+ videos = mkOption {
+ type = types.str;
+ default = "$HOME/Videos";
+ description = "The Videos directory.";
+ };
+
+ extraConfig = mkOption {
+ type = with types; attrsOf str;
+ default = { };
+ example = { XDG_MISC_DIR = "$HOME/Misc"; };
+ description = "Other user directories.";
+ };
+ };
+
+ config = mkIf cfg.enable {
+ xdg.configFile."user-dirs.dirs".text = generators.toKeyValue {} (
+ {
+ XDG_DESKTOP_DIR = cfg.desktop;
+ XDG_DOCUMENTS_DIR = cfg.documents;
+ XDG_DOWNLOAD_DIR = cfg.download;
+ XDG_MUSIC_DIR = cfg.music;
+ XDG_PICTURES_DIR = cfg.pictures;
+ XDG_PUBLICSHARE_DIR = cfg.publishShare;
+ XDG_TEMPLATES_DIR = cfg.templates;
+ XDG_VIDEOS_DIR = cfg.videos;
+ }
+ // cfg.extraConfig
+ );
+ };
+}