nixos/home/modules/filetypes.nix

48 lines
1.2 KiB
Nix

{ config, lib, pkgs, ... }:
let cfg = config.snowhawk.defaultPrograms;
in {
options.snowhawk.defaultPrograms = {
enable = lib.mkEnableOption "default programs";
};
config = lib.mkIf cfg.enable {
xdg.mimeApps =
let
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"
];
mimeAppsFor =
value: list:
lib.genAttrs list (name: value);
in
{
enable = true;
defaultApplications = lib.mkMerge [
(mimeAppsFor browser browserApps)
(mimeAppsFor "brave-browser.desktop" [
"x-scheme-handler/chrome"
])
];
associations.added = lib.mkMerge [
(mimeAppsFor browser browserApps)
];
};
home.sessionVariables = {
DEFAULT_BROWSER = lib.getExe pkgs.firefox;
};
};
}