nixos/home/modules/filetypes.nix

49 lines
1.2 KiB
Nix
Raw Normal View History

2024-06-27 22:31:33 -07:00
{ config, lib, pkgs, ... }:
let cfg = config.snowhawk.defaultPrograms;
in {
options.snowhawk.defaultPrograms = {
enable = lib.mkEnableOption "default programs";
};
2024-06-27 23:23:02 -07:00
config = lib.mkIf cfg.enable {
2024-07-28 23:02:47 -07:00
xdg.mimeApps =
let
2024-10-16 17:33:24 -07:00
browser = "firefox.desktop";
browserApps = [
"application/pdf"
"application/x-extension-htm"
"application/x-extension-html"
"application/x-extension-shtml"
"application/x-extension-xht"
"application/x-extension-xhtml"
"application/xhtml+xml"
"text/html"
"x-scheme-handler/http"
"x-scheme-handler/https"
];
2024-07-28 23:02:47 -07:00
mimeAppsFor =
value: list:
2024-07-30 01:11:06 -07:00
lib.genAttrs list (name: value);
2024-07-28 23:02:47 -07:00
in
{
enable = true;
defaultApplications = lib.mkMerge [
(mimeAppsFor browser browserApps)
2024-10-16 17:33:24 -07:00
(mimeAppsFor "brave-browser.desktop" [
"x-scheme-handler/chrome"
])
2024-07-28 23:02:47 -07:00
];
associations.added = lib.mkMerge [
(mimeAppsFor browser browserApps)
];
2024-06-27 22:31:33 -07:00
};
home.sessionVariables = {
2024-10-17 18:48:51 -07:00
DEFAULT_BROWSER = lib.getExe pkgs.firefox;
2024-06-27 22:31:33 -07:00
};
};
}