/ modules / home / xdg.nix
xdg.nix
 1  {
 2    lib,
 3    pkgs,
 4    config,
 5    ...
 6  }:
 7  {
 8    xdg = lib.mkIf pkgs.stdenv.isLinux {
 9      enable = true;
10      mime.enable = true;
11      mimeApps.enable = true;
12  
13      configFile."environment.d/envvars.conf".text = ''
14        PATH="$HOME/.nix-profile/bin:$PATH"
15      '';
16  
17      portal = {
18        enable = true;
19        xdgOpenUsePortal = true;
20  
21        extraPortals = with pkgs; [
22          # xdg-desktop-portal
23          xdg-desktop-portal-gtk
24          xdg-desktop-portal-hyprland
25        ];
26  
27        configPackages = with pkgs; [
28          xdg-desktop-portal
29          xdg-desktop-portal-gtk
30          xdg-desktop-portal-hyprland
31        ];
32      };
33  
34      userDirs = {
35        enable = true;
36        createDirectories = true;
37  
38        # Define standard XDG user directories
39        music = "${config.home.homeDirectory}/Music";
40        videos = "${config.home.homeDirectory}/Videos";
41        desktop = "${config.home.homeDirectory}/Desktop";
42        pictures = "${config.home.homeDirectory}/Pictures";
43        download = "${config.home.homeDirectory}/Downloads";
44        publicShare = "${config.home.homeDirectory}/Public";
45        documents = "${config.home.homeDirectory}/Documents";
46        templates = "${config.home.homeDirectory}/Templates";
47      };
48  
49      # Define standard XDG base directories
50      cacheHome = "${config.home.homeDirectory}/.cache";
51      configHome = "${config.home.homeDirectory}/.config";
52      dataHome = "${config.home.homeDirectory}/.local/share";
53      stateHome = "${config.home.homeDirectory}/.local/state";
54    };
55  }