{ 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 = "brave-browser.desktop"; mimeAppsFor = value: list: lib.right builtins.listToAttrs (map (name: { inherit name value; })) list; 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/chrome" "x-scheme-handler/http" "x-scheme-handler/https" ]) ]; }; home.sessionVariables = { DEFAULT_BROWSER = "${pkgs.brave}/bin/brave"; }; }; }