about summary refs log tree commit diff
path: root/modules/xdg/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/xdg/default.nix')
-rw-r--r--modules/xdg/default.nix27
1 files changed, 13 insertions, 14 deletions
diff --git a/modules/xdg/default.nix b/modules/xdg/default.nix
index d3a2d1235144..fc552883fb16 100644
--- a/modules/xdg/default.nix
+++ b/modules/xdg/default.nix
@@ -2,35 +2,34 @@
 
 let
   inherit (lib) mapAttrsToList mkOption;
-  inherit (lib.types) attrsOf path submodule;
+  inherit (lib.types) loaOf attrsOf path submodule;
   inherit (pkgs) linkFarm;
 
+  userOptions = {
+    options.xdg.config.paths = mkOption {
+      default = {};
+      type = attrsOf path;
+    };
+  };
+
 in
   {
     options = {
-      xdg.config.users = mkOption {
-        default = {};
-        type = attrsOf (submodule ({ ... }: {
-          options = {
-            paths = mkOption {
-              default = {};
-              type = attrsOf path;
-            };
-          };
-        }));
+      users.users = mkOption {
+        type = loaOf (submodule userOptions);
       };
     };
 
     config = {
       environment.etc."xdg/nixos/per-user".source =
         linkFarm "xdg-config-users"
-                  (mapAttrsToList (user: { paths, ... }: {
+                  (mapAttrsToList (user: { xdg, ... }: {
                     name = user;
                     path = linkFarm "${user}-xdg-config-home"
                                     (mapAttrsToList
                                       (name: path: { inherit name path; })
-                                      paths);
-                  }) config.xdg.config.users);
+                                      xdg.config.paths);
+                  }) config.users.users);
 
       environment.extraInit = ''
         etc_xdg_config_home=/run/current-system/etc/xdg/nixos/per-user/$USER