mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-23 16:29:42 -04:00
30 lines
825 B
Nix
30 lines
825 B
Nix
{ lib, config, ... }:
|
|
|
|
let
|
|
programs = config.programs;
|
|
|
|
defaultBrowser =
|
|
if programs.firefox.enable then "firefox.desktop"
|
|
else if programs.brave.enable then "brave-browser.desktop"
|
|
else if programs.chromium.enable then "chromium.desktop"
|
|
else null;
|
|
|
|
types = [
|
|
"text/html" "application/xhtml+xml"
|
|
"x-scheme-handler/http" "x-scheme-handler/https"
|
|
"application/pdf"
|
|
"image/png" "image/jpeg" "image/jpg" "image/gif"
|
|
"image/webp" "image/avif" "image/bmp" "image/tiff" "image/svg+xml"
|
|
"video/mp4" "video/webm" "video/mkv" "video/avi"
|
|
"video/x-matroska" "video/quicktime"
|
|
];
|
|
|
|
in
|
|
{
|
|
xdg.mimeApps = lib.mkIf (defaultBrowser != null) {
|
|
enable = true;
|
|
defaultApplications = builtins.listToAttrs (
|
|
map (t: { name = t; value = [ defaultBrowser ]; }) types
|
|
);
|
|
};
|
|
}
|