From ea18558cb394cf3903f0c8d6ae1c95319e672e15 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Sat, 7 Feb 2026 13:16:42 +0100 Subject: [PATCH] add code mime files Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- home/system/mime/default.nix | 53 +++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/home/system/mime/default.nix b/home/system/mime/default.nix index ec769f6..99824ac 100644 --- a/home/system/mime/default.nix +++ b/home/system/mime/default.nix @@ -1,10 +1,15 @@ # Mime type associations for the system. -{lib, ...}: +{ + lib, + pkgs, + ... +}: with lib; let defaultApps = { # check desktop files here: `ls $(echo $XDG_DATA_DIRS| sed "s/:/ /g")` browser = ["brave.desktop"]; text = ["org.gnome.TextEditor.desktop"]; + code = ["nvim-ghostty.desktop"]; image = ["imv-dir.desktop"]; audio = ["mpv.desktop"]; video = ["mpv.desktop"]; @@ -18,6 +23,41 @@ with lib; let mimeMap = { text = ["text/plain"]; + code = [ + "text/x-csrc" + "text/x-chdr" + "text/x-c++src" + "text/x-c++hdr" + "text/x-rust" + "text/x-go" + "text/x-java" + "text/x-csharp" + + "text/x-python" + "application/x-shellscript" + "text/javascript" + "application/javascript" + "text/css" + "text/x-php" + "text/x-ruby" + + "application/json" + "application/xml" + "text/xml" + "text/x-yaml" + "application/x-yaml" + "application/toml" + "text/x-nix" + "text/markdown" + + "text/x-dockerfile" + "application/x-yaml" + "text/x-terraform" + + "application/x-perl" + "text/x-lua" + "text/x-haskell" + ]; image = [ "image/bmp" "image/gif" @@ -79,11 +119,22 @@ with lib; let discord = ["x-scheme-handler/discord"]; }; + nvim-ghostty = pkgs.makeDesktopItem { + name = "nvim-ghostty"; + desktopName = "Neovim (Ghostty)"; + exec = "ghostty -e nvim %F"; + terminal = false; + categories = ["Development" "TextEditor"]; + mimeTypes = mimeMap.code ++ mimeMap.text; + }; + associations = with lists; listToAttrs (flatten (mapAttrsToList (key: map (type: attrsets.nameValuePair type defaultApps."${key}")) mimeMap)); in { + home.packages = [nvim-ghostty]; + xdg = { configFile."mimeapps.list".force = true; mimeApps = {