From 89908c69b7819c7c50cdfa7219d9ef77edfdd65e Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Tue, 14 Apr 2026 17:08:53 +0200 Subject: modules/xdg: Move the rest of the xdg config here --- modules/by-name/xd/xdg/module.nix | 82 ++++++++++++++++++++++++++------------- modules/home.legacy/default.nix | 35 +---------------- 2 files changed, 57 insertions(+), 60 deletions(-) diff --git a/modules/by-name/xd/xdg/module.nix b/modules/by-name/xd/xdg/module.nix index 9ff71ca0..108e0179 100644 --- a/modules/by-name/xd/xdg/module.nix +++ b/modules/by-name/xd/xdg/module.nix @@ -47,36 +47,63 @@ in { }; config = lib.mkIf cfg.enable { - home-manager.users.soispha = { - xdg = { - configFile."xdg-desktop-portal-termfilechooser/config".source = tfcConfigFile; - - desktopEntries = { - url-handler = { - name = "url-handler"; - genericName = "Web Browser"; - exec = "${lib.getExe url-handler} %u"; - terminal = false; - categories = [ - "Application" - "Network" - "WebBrowser" - ]; - mimeType = [ - "text/html" - "text/xml" - "x-scheme-handler/http" - "x-scheme-handler/https" - "x-scheme-handler/about" - "x-scheme-handler/unknown" - ]; - }; + home-manager.users.soispha.xdg = let + inherit (config.home-manager.users.soispha.home) homeDirectory; + in { + enable = true; + + configFile."xdg-desktop-portal-termfilechooser/config".source = tfcConfigFile; + + configHome = "${homeDirectory}/.config"; + dataHome = "${homeDirectory}/.local/share"; + stateHome = "${homeDirectory}/.local/state"; + cacheHome = "${homeDirectory}/.cache"; + + userDirs = { + enable = true; + + # TODO: We shouldn't build on these variables to exist, but currently my config + # might expect them. So let's just keep it. See here for a full explanation: + # https://github.com/nix-community/home-manager/pull/7937#issuecomment-3372232126 + # <2026-04-14> + setSessionVariables = true; + + createDirectories = true; + + documents = "${homeDirectory}/documents/general"; + download = "/tmp/download"; + music = "${homeDirectory}/media/music"; + pictures = "${homeDirectory}/media/pictures"; + videos = "${homeDirectory}/media/videos"; + + templates = null; + publicShare = null; + desktop = null; + }; + + desktopEntries = { + url-handler = { + name = "url-handler"; + genericName = "Web Browser"; + exec = "${lib.getExe url-handler} %u"; + terminal = false; + categories = [ + "Application" + "Network" + "WebBrowser" + ]; + mimeType = [ + "text/html" + "text/xml" + "x-scheme-handler/http" + "x-scheme-handler/https" + "x-scheme-handler/about" + "x-scheme-handler/unknown" + ]; }; }; }; - services.dbus.enable = true; - xdg = { mime = { enable = true; @@ -98,6 +125,7 @@ in { wlr = { enable = true; }; + config = { common = { default = ["wlr"]; @@ -118,6 +146,8 @@ in { }; }; + services.dbus.enable = true; + systemd.user.services.xdg-desktop-portal-termfilechooser = { serviceConfig.ExecStart = [ "" diff --git a/modules/home.legacy/default.nix b/modules/home.legacy/default.nix index 8fb209f3..7cc9bb45 100644 --- a/modules/home.legacy/default.nix +++ b/modules/home.legacy/default.nix @@ -7,17 +7,7 @@ # # You should have received a copy of the License along with this program. # If not, see . -{config, ...}: let - inherit (config.home) homeDirectory; - - # xdg - configHome = "${homeDirectory}/.config"; - dataHome = "${homeDirectory}/.local/share"; - stateHome = "${homeDirectory}/.local/state"; - cacheHome = "${homeDirectory}/.cache"; - binHome = "${homeDirectory}/.local/bin"; - # TODO: add XDG_RUNTIME_DIR -in { +{...}: { imports = [ ./conf ./files @@ -26,27 +16,4 @@ in { # I don't know what this does, but I've seen it a lot online, so it should be good, right? programs.home-manager.enable = true; - - xdg = { - enable = true; - inherit configHome dataHome stateHome cacheHome; #binHome; # TODO: add binHome, when the standard is extended - - /* - TODO: add this - desktopEntries = {}; - */ - - userDirs = { - enable = true; - createDirectories = true; - desktop = null; - documents = "${homeDirectory}/documents/general"; - download = "/tmp/download"; - music = "${homeDirectory}/media/music"; - pictures = "${homeDirectory}/media/pictures"; - videos = "${homeDirectory}/media/videos"; - templates = "${homeDirectory}/media/templates"; - publicShare = "${homeDirectory}/media/public"; - }; - }; } -- cgit 1.4.1