System: Replace mime configuration with system-specific module usage
This commit is contained in:
@ -79,7 +79,7 @@ with mylib.networking; {
|
||||
|
||||
# plymouth.enable = true;
|
||||
loader = {
|
||||
timeout = 120;
|
||||
timeout = 10;
|
||||
systemd-boot = {
|
||||
enable = true;
|
||||
configurationLimit = 5;
|
||||
@ -157,160 +157,6 @@ with mylib.networking; {
|
||||
};
|
||||
|
||||
xdg = {
|
||||
# See https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
|
||||
# Find .desktop files: fd ".*\.desktop" / | grep --color=auto -E neovide
|
||||
mime = let
|
||||
textTypes = [
|
||||
"text/css"
|
||||
"text/csv"
|
||||
"text/javascript"
|
||||
"text/plain"
|
||||
"text/xml"
|
||||
"application/json"
|
||||
"application/ld+json"
|
||||
"application/x-sh"
|
||||
"application/xml"
|
||||
];
|
||||
imageTypes = [
|
||||
"image/apng"
|
||||
"image/avif"
|
||||
"image/bmp"
|
||||
"image/gif"
|
||||
"image/jpeg"
|
||||
"image/png"
|
||||
"image/svg+xml"
|
||||
"image/tiff"
|
||||
"image/webp"
|
||||
];
|
||||
audioTypes = [
|
||||
"audio/aac"
|
||||
"audio/mpeg"
|
||||
"audio/ogg"
|
||||
"audio/opus"
|
||||
"audio/wav"
|
||||
"audio/webm"
|
||||
"audio/3gpp"
|
||||
"audio/3gpp2"
|
||||
];
|
||||
videoTypes = [
|
||||
"video/x-msvideo"
|
||||
"video/mp4"
|
||||
"video/mpeg"
|
||||
"video/ogg"
|
||||
"video/mp2t"
|
||||
"video/webm"
|
||||
"video/3gpp"
|
||||
"video/3gpp2"
|
||||
];
|
||||
webTypes = [
|
||||
"text/uri-list"
|
||||
"text/x-uri"
|
||||
"text/html"
|
||||
"application/xhtml+xml"
|
||||
"x-scheme-handler/https"
|
||||
];
|
||||
in rec {
|
||||
enable = true;
|
||||
|
||||
defaultApplications = let
|
||||
associations = {
|
||||
"neovide.desktop" = textTypes ++ [];
|
||||
"yazi.desktop" = ["inode/directory"];
|
||||
"firefox.desktop" = webTypes ++ [];
|
||||
"org.pwmt.zathura.desktop" = ["application/pdf"];
|
||||
"imv-dir.desktop" = imageTypes ++ []; # imv-dir autoselects the directory so next/prev works
|
||||
"vlc.desktop" = audioTypes ++ videoTypes ++ [];
|
||||
};
|
||||
|
||||
# Applied to a single app and a single type
|
||||
mkAssociation = app: type: {${type} = [app];}; # Result: { "image/jpg" = ["imv.desktop"]; }
|
||||
|
||||
# Applied to a single app and a list of types
|
||||
mkAssociations = app: types: lib.mergeAttrsList (builtins.map (mkAssociation app) types); # Result: { "image/jpg" = ["imv.desktop"]; "image/png" = ["imv.desktop"]; ... }
|
||||
in
|
||||
# Apply to a list of apps each with a list of types
|
||||
lib.mergeAttrsList (lib.mapAttrsToList mkAssociations associations);
|
||||
|
||||
addedAssociations = defaultApplications;
|
||||
|
||||
removedAssociations = let
|
||||
fromTextTypes = [
|
||||
"nvim.desktop"
|
||||
];
|
||||
|
||||
fromImageTypes = [
|
||||
"imv.desktop"
|
||||
"chromium-browser.desktop"
|
||||
"org.kde.krita.desktop"
|
||||
"krita.desktop"
|
||||
"krita_svg.desktop"
|
||||
"krita_raw.desktop"
|
||||
"krita_heif.desktop"
|
||||
"krita_webp.desktop"
|
||||
"krita_gif.desktop"
|
||||
"krita_brush.desktop"
|
||||
"krita_xcf.desktop"
|
||||
"krita_jpeg.desktop"
|
||||
"krita_spriter.desktop"
|
||||
"krita_jxl.desktop"
|
||||
"krita_ora.desktop"
|
||||
"krita_csv.desktop"
|
||||
"krita_tga.desktop"
|
||||
"krita_psd.desktop"
|
||||
"krita_png.desktop"
|
||||
"krita_tiff.desktop"
|
||||
"krita_exr.desktop"
|
||||
"krita_qimageio.desktop"
|
||||
"krita_pdf.desktop"
|
||||
"krita_jp2.desktop"
|
||||
"krita_heightmap.desktop"
|
||||
"krita_kra.desktop"
|
||||
"krita_krz.desktop"
|
||||
];
|
||||
|
||||
fromAudioTypes = [];
|
||||
|
||||
fromVideoTypes = [];
|
||||
|
||||
fromWebTypes = [
|
||||
"chromium-browser.desktop"
|
||||
"com.google.Chrome.desktop"
|
||||
];
|
||||
|
||||
# Applied to a list of apps and a single type
|
||||
removeAssociation = apps: type: {${type} = apps;};
|
||||
|
||||
# Applied to a list of apps and a list of types: For each type the list of apps should be removed
|
||||
removeAssociations = apps: types: lib.mergeAttrsList (builtins.map (removeAssociation apps) types);
|
||||
in
|
||||
lib.mergeAttrsList [
|
||||
{
|
||||
"application/pdf" = [
|
||||
"chromium-browser.desktop"
|
||||
"com.google.Chrome.desktop"
|
||||
"firefox.desktop"
|
||||
];
|
||||
"text/plain" = [
|
||||
"firefox.desktop"
|
||||
"code.desktop"
|
||||
];
|
||||
}
|
||||
|
||||
# Only activate those if applications to remove are specified: (len from...Types) > 0
|
||||
(lib.optionalAttrs (builtins.lessThan 0 (builtins.length fromTextTypes))
|
||||
(removeAssociations fromTextTypes textTypes))
|
||||
(lib.optionalAttrs (builtins.lessThan 0 (builtins.length fromImageTypes))
|
||||
(removeAssociations fromImageTypes imageTypes))
|
||||
(lib.optionalAttrs (builtins.lessThan 0 (builtins.length fromAudioTypes))
|
||||
(removeAssociations fromAudioTypes audioTypes))
|
||||
(lib.optionalAttrs (builtins.lessThan 0 (builtins.length fromVideoTypes))
|
||||
(removeAssociations fromVideoTypes videoTypes))
|
||||
(lib.optionalAttrs (builtins.lessThan 0 (builtins.length fromWebTypes))
|
||||
(removeAssociations fromWebTypes webTypes))
|
||||
];
|
||||
};
|
||||
|
||||
# XDG
|
||||
portal = {
|
||||
enable = true;
|
||||
xdgOpenUsePortal = false;
|
||||
@ -369,7 +215,7 @@ with mylib.networking; {
|
||||
defaultFonts = {
|
||||
serif = ["Noto Serif CJK SC"];
|
||||
sansSerif = ["Noto Sans CJK SC"];
|
||||
monospace = ["MonoLisa" "JetBrainsMono Nerd Font Mono"]; # NOTE: Match with color.font
|
||||
monospace = ["MonoLisa Alt Script" "JetBrainsMono Nerd Font Mono"]; # NOTE: Match with color.font
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -11,6 +11,18 @@
|
||||
];
|
||||
|
||||
modules = {
|
||||
mime = {
|
||||
enable = true;
|
||||
|
||||
defaultTextEditor = "neovide.desktop";
|
||||
defaultFileBrowser = "yazi.desktop";
|
||||
defaultWebBrowser = "firefox.desktop";
|
||||
defaultPdfViewer = "org.pwmt.zathura.desktop";
|
||||
defaultImageViewer = "imv-dir.desktop";
|
||||
defaultAudioPlayer = "vlc.desktop";
|
||||
defaultVideoPlayer = "vlc.desktop";
|
||||
};
|
||||
|
||||
network = {
|
||||
# Systemd-networkd configs
|
||||
networks = {
|
||||
|
@ -6,6 +6,18 @@
|
||||
];
|
||||
|
||||
modules = {
|
||||
mime = {
|
||||
enable = true;
|
||||
|
||||
defaultTextEditor = "neovide.desktop";
|
||||
defaultFileBrowser = "yazi.desktop";
|
||||
defaultWebBrowser = "firefox.desktop";
|
||||
defaultPdfViewer = "org.pwmt.zathura.desktop";
|
||||
defaultImageViewer = "imv-dir.desktop";
|
||||
defaultAudioPlayer = "vlc.desktop";
|
||||
defaultVideoPlayer = "vlc.desktop";
|
||||
};
|
||||
|
||||
network = {
|
||||
wireguard-tunnels = {
|
||||
wg0-de-74 =
|
||||
|
Reference in New Issue
Block a user