diff options
author | tdback <tyler@tdback.net> | 2024-12-24 17:07:24 -0500 |
---|---|---|
committer | tdback <tyler@tdback.net> | 2024-12-24 17:07:24 -0500 |
commit | b10b5a159161b4e2eb715193693b34849983f092 (patch) | |
tree | bad04f0c2fb8435244d13b84548e06c7049eb79e | |
parent | 72c487e0e39e5ce18925e5b0f1395e313be37d65 (diff) |
clean up generation of xdg directories
-rw-r--r-- | users/tdback/desktop.nix | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/users/tdback/desktop.nix b/users/tdback/desktop.nix index e2f754b..6f0da18 100644 --- a/users/tdback/desktop.nix +++ b/users/tdback/desktop.nix @@ -1,13 +1,20 @@ { config, pkgs, ... }: let - dirs = [ "desktop" "documents" "download" "music" "pictures" "publicShare" "templates" "videos" ]; - defined = { - "documents" = "${config.home.homeDirectory}/documents"; - "download" = "${config.home.homeDirectory}/downloads"; - }; - userDirs = - builtins.map (dir: { name = dir; value = defined.${dir} or null; }) dirs - |> builtins.listToAttrs; + mkDirs = defined: + let + home = config.home.homeDirectory; + dirs = [ "desktop" "documents" "download" "music" "pictures" "publicShare" "templates" "videos" ]; + in + builtins.listToAttrs ( + builtins.map (dir: { + name = dir; + value = + if builtins.hasAttr dir defined then + "${home}/${defined.${dir}}" + else + null; + }) dirs + ); in { imports = [ @@ -50,7 +57,7 @@ in userDirs = { enable = true; createDirectories = true; - } // userDirs; + } // (mkDirs { documents = "documents"; download = "downloads"; }); }; qt = { |