Commit 2015eb6

HPCesia <me@hpcesia.com>
2025-09-30 17:14:24
refactor: migrate xdg config
1 parent c7e01e8
Changed files (3)
home
linux
modules
core
desktop
home/linux/gui/xdg.nix
@@ -1,41 +1,6 @@
-{
-  config,
-  pkgs,
-  ...
-}: {
-  home.packages = with pkgs; [
-    xdg-utils # provides cli tools such as `xdg-mime` `xdg-open`
-    xdg-user-dirs
-  ];
-
-  xdg.configFile."mimeapps.list".force = true;
+{pkgs, ...}: {
   xdg = {
-    enable = true;
-
-    cacheHome = "${config.home.homeDirectory}/.cache";
-    configHome = "${config.home.homeDirectory}/.config";
-    dataHome = "${config.home.homeDirectory}/.local/share";
-    stateHome = "${config.home.homeDirectory}/.local/state";
-
-    userDirs = {
-      enable = true;
-      createDirectories = true;
-      # Use English user directroy path
-      desktop = "${config.home.homeDirectory}/Desktop";
-      documents = "${config.home.homeDirectory}/Documents";
-      download = "${config.home.homeDirectory}/Download";
-      music = "${config.home.homeDirectory}/Music";
-      pictures = "${config.home.homeDirectory}/Pictures";
-      publicShare = "${config.home.homeDirectory}/Public";
-      templates = "${config.home.homeDirectory}/Templates";
-      videos = "${config.home.homeDirectory}/Videos";
-      extraConfig = {
-        XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots";
-      };
-    };
-
     mimeApps = {
-      enable = true;
       defaultApplications = let
         browser = ["firefox.desktop"];
         editor = ["Helix.desktop" "code.desktop"];
modules/core/xdg.nix
@@ -0,0 +1,11 @@
+{
+  flake.modules.homeManager.core = {config, ...}: {
+    xdg = {
+      enable = true;
+      cacheHome = "${config.home.homeDirectory}/.cache";
+      configHome = "${config.home.homeDirectory}/.config";
+      dataHome = "${config.home.homeDirectory}/.local/share";
+      stateHome = "${config.home.homeDirectory}/.local/state";
+    };
+  };
+}
modules/desktop/xdg.nix
@@ -0,0 +1,31 @@
+{
+  flake.modules.homeManager.desktop = {
+    config,
+    pkgs,
+    ...
+  }: {
+    home.packages = with pkgs; [
+      xdg-utils # provides cli tools such as `xdg-mime` `xdg-open`
+      xdg-user-dirs
+    ];
+
+    xdg.userDirs = {
+      enable = true;
+      createDirectories = true;
+      # Use English user directroy path
+      desktop = "${config.home.homeDirectory}/Desktop";
+      documents = "${config.home.homeDirectory}/Documents";
+      download = "${config.home.homeDirectory}/Download";
+      music = "${config.home.homeDirectory}/Music";
+      pictures = "${config.home.homeDirectory}/Pictures";
+      publicShare = "${config.home.homeDirectory}/Public";
+      templates = "${config.home.homeDirectory}/Templates";
+      videos = "${config.home.homeDirectory}/Videos";
+      extraConfig = {
+        XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots";
+      };
+    };
+    xdg.configFile."mimeapps.list".force = true;
+    xdg.mimeApps.enable = true;
+  };
+}