diff options
author | Azat Bahawi <azat@bahawi.net> | 2024-04-21 02:15:42 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2024-04-21 02:15:42 +0300 |
commit | e6ed60548397627bf10f561f9438201dbba0a36e (patch) | |
tree | f9a84c5957d2cc4fcd148065ee9365a0c851ae1c /modules/common/xdg.nix | |
parent | 2024-04-18 (diff) |
2024-04-21
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 + ); + }; + }) + ]; }; } |