diff options
Diffstat (limited to '')
-rw-r--r-- | modules/common/xdg.nix (renamed from modules/common/common/xdg.nix) | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/modules/common/common/xdg.nix b/modules/common/xdg.nix index 4463c15..c581369 100644 --- a/modules/common/common/xdg.nix +++ b/modules/common/xdg.nix @@ -1,5 +1,13 @@ -{ config, lib, ... }: +{ + config, + lib, + this, + ... +}: with lib; +let + cfg = config.nixfiles.modules.common.xdg; +in { imports = let @@ -68,5 +76,34 @@ with lib; videos = tmp; }; }; + defaultApplications = mkOption { + description = "Default applications."; + type = with types; attrsOf (listOf str); + default = { }; + }; + }; + + config = { + xdg.portal = mkIf this.isHeadful { enable = true; }; + + hm.xdg = mkMerge [ + (with cfg; { + enable = true; + + inherit cacheHome; + inherit configHome; + inherit dataHome; + inherit stateHome; + inherit userDirs; + }) + (mkIf this.isHeadful { + mimeApps = { + enable = true; + defaultApplications = mkMerge ( + mapAttrsToList (n: v: genAttrs v (_: [ "${n}.desktop" ])) cfg.defaultApplications + ); + }; + }) + ]; }; } |