about summary refs log tree commit diff
path: root/modules/xdg/default.nix
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2019-11-05 14:12:58 +0000
committerAlyssa Ross <hi@alyssa.is>2019-12-16 22:03:52 +0000
commitef3559f38d5ef64ff1707b5e19b0d4a51536bea2 (patch)
tree3639e67a11d5f654ad8bb28843595f4bc5a8a286 /modules/xdg/default.nix
parentf6765e3e3effd6efeb9a593b48052149ee8de927 (diff)
downloadnixlib-ef3559f38d5ef64ff1707b5e19b0d4a51536bea2.tar
nixlib-ef3559f38d5ef64ff1707b5e19b0d4a51536bea2.tar.gz
nixlib-ef3559f38d5ef64ff1707b5e19b0d4a51536bea2.tar.bz2
nixlib-ef3559f38d5ef64ff1707b5e19b0d4a51536bea2.tar.lz
nixlib-ef3559f38d5ef64ff1707b5e19b0d4a51536bea2.tar.xz
nixlib-ef3559f38d5ef64ff1707b5e19b0d4a51536bea2.tar.zst
nixlib-ef3559f38d5ef64ff1707b5e19b0d4a51536bea2.zip
modules/xdg: keep per-user options under the users hierarchy
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