{ 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"; mimeAppsFor = value: list: lib.genAttrs list (name: value); in { enable = true; defaultApplications = lib.mkMerge [ (mimeAppsFor browser [ "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/about" "x-scheme-handler/http" "x-scheme-handler/https" ]) (mimeAppsFor "brave-browser.desktop" [ "x-scheme-handler/chrome" ]) ]; }; home.sessionVariables = { DEFAULT_BROWSER = "${pkgs.brave}/bin/brave"; }; }; }