summaryrefslogtreecommitdiff
path: root/hm/conf/xdg-dirs.nix
blob: c6cf03bca159ad0da7112be1cbe499a2b1dfc40b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ config, lib, ... }:
let
  cfg = config.hm.conf.xdg-dirs;
in
{
  options.hm.conf.xdg-dirs = {
    enable = lib.mkEnableOption "enables xdg dirs";

    mediaPath = lib.mkOption {
      type = lib.types.path;
      default = config.home.homeDirectory;
      description = "base path for media";
    };
  };
  config = lib.mkIf cfg.enable {
    xdg.userDirs = {
      enable = true;
      createDirectories = true;

      download = "${config.home.homeDirectory}/dl";
      documents = "${config.home.homeDirectory}/docs";
      
      pictures = "${toString cfg.mediaPath}/pics";
      videos   = "${toString cfg.mediaPath}/vids";

      desktop = null;
      music = null;
      publicShare = null;
      templates = null;

      extraConfig = {
        XDG_PROJECTS_DIR = "${config.home.homeDirectory}/proj";
        XDG_GAMES_DIR = "${config.home.homeDirectory}/games";
        XDG_MEDIA_DIR = "${toString cfg.mediaPath}";
        XDG_SS_DIR = "${toString cfg.mediaPath}/pics/ss";
        XDG_CLIPS_DIR = "${toString cfg.mediaPath}/vids/clips";
        XDG_ARCHIVE_DIR = "${toString cfg.mediaPath}/archive";
      };
    };
      home.sessionVariables = { 
        XDG_PROJECTS_DIR = "${config.home.homeDirectory}/proj";
        XDG_GAMES_DIR = "${config.home.homeDirectory}/games";
        XDG_MEDIA_DIR = "${toString cfg.mediaPath}";
        XDG_SS_DIR = "${toString cfg.mediaPath}/pics/ss";
        XDG_CLIPS_DIR = "${toString cfg.mediaPath}/vids/clips";
        XDG_ARCHIVE_DIR = "${toString cfg.mediaPath}/archive";
      };
  };
}