about summary refs log tree commit diff
path: root/modules/common/xdg.nix
diff options
context:
space:
mode:
authorazahi <azat@bahawi.net>2024-11-10 01:08:38 +0300
committerazahi <azat@bahawi.net>2024-11-10 01:08:38 +0300
commit693768ee37098dbebb38c86e27044f2faa38348d (patch)
tree37c92a1c83cf22fa5e5a570baa8598ba6063c795 /modules/common/xdg.nix
parent2024-10-29 (diff)
2024-11-10 HEAD master
Diffstat (limited to '')
-rw-r--r--modules/common/xdg.nix43
1 files changed, 21 insertions, 22 deletions
diff --git a/modules/common/xdg.nix b/modules/common/xdg.nix
index 0b807b7..df7d624 100644
--- a/modules/common/xdg.nix
+++ b/modules/common/xdg.nix
@@ -4,7 +4,6 @@
   this,
   ...
 }:
-with lib;
 let
   cfg = config.nixfiles.modules.common.xdg;
 in
@@ -20,44 +19,44 @@ in
       ];
     in
     [
-      (mkAliasOptionModule [
+      (lib.mkAliasOptionModule [
         "dirs"
         "cache"
       ] (withBase "cacheHome"))
-      (mkAliasOptionModule [
+      (lib.mkAliasOptionModule [
         "dirs"
         "config"
       ] (withBase "configHome"))
-      (mkAliasOptionModule [
+      (lib.mkAliasOptionModule [
         "dirs"
         "data"
       ] (withBase "dataHome"))
-      (mkAliasOptionModule [
+      (lib.mkAliasOptionModule [
         "dirs"
         "state"
       ] (withBase "stateHome"))
-      (mkAliasOptionModule [ "userDirs" ] (withBase "userDirs"))
+      (lib.mkAliasOptionModule [ "userDirs" ] (withBase "userDirs"))
     ];
 
   options.nixfiles.modules.common.xdg = {
-    cacheHome = mkOption {
-      type = types.str;
+    cacheHome = lib.mkOption {
+      type = lib.types.str;
       default = "${config.hm.home.homeDirectory}/.cache";
     };
-    configHome = mkOption {
-      type = types.str;
+    configHome = lib.mkOption {
+      type = lib.types.str;
       default = "${config.hm.home.homeDirectory}/.config";
     };
-    dataHome = mkOption {
-      type = types.str;
+    dataHome = lib.mkOption {
+      type = lib.types.str;
       default = "${config.hm.home.homeDirectory}/.local/share";
     };
-    stateHome = mkOption {
-      type = types.str;
+    stateHome = lib.mkOption {
+      type = lib.types.str;
       default = "${config.hm.home.homeDirectory}/.local/state";
     };
-    userDirs = mkOption {
-      type = types.attrs;
+    userDirs = lib.mkOption {
+      type = lib.types.attrs;
       default =
         let
           inherit (config.my) home;
@@ -76,9 +75,9 @@ in
           videos = tmp;
         };
     };
-    defaultApplications = mkOption {
+    defaultApplications = lib.mkOption {
       description = "Default applications.";
-      type = with types; attrsOf (listOf str);
+      type = with lib.types; attrsOf (listOf str);
       default = { };
     };
   };
@@ -89,7 +88,7 @@ in
       sounds.enable = this.isHeadful;
     };
 
-    hm.xdg = mkMerge [
+    hm.xdg = lib.mkMerge [
       (with cfg; {
         enable = true;
 
@@ -99,11 +98,11 @@ in
         inherit stateHome;
         inherit userDirs;
       })
-      (mkIf this.isHeadful {
+      (lib.mkIf this.isHeadful {
         mimeApps = {
           enable = true;
-          defaultApplications = mkMerge (
-            mapAttrsToList (n: v: genAttrs v (_: [ "${n}.desktop" ])) cfg.defaultApplications
+          defaultApplications = lib.mkMerge (
+            lib.mapAttrsToList (n: v: lib.genAttrs v (_: [ "${n}.desktop" ])) cfg.defaultApplications
           );
         };
       })

Consider giving Nix/NixOS a try! <3