From 070df903b5f5bd91f62fec103118e4b125d3a523 Mon Sep 17 00:00:00 2001 From: LordGrimmauld Date: Sat, 27 Apr 2024 14:20:48 +0200 Subject: [PATCH] fix mime --- common/graphics/qt.nix | 1 + common/tooling/default.nix | 6 +++ common/tooling/nix.nix | 4 ++ common/xdg/default.nix | 6 +++ common/xdg/mime.nix | 76 ++++++++++++++++++++++++++++++++++++ common/{ => xdg}/portals.nix | 2 + configuration.nix | 11 +----- load_common.nix | 2 +- modules/users.nix | 1 + 9 files changed, 99 insertions(+), 10 deletions(-) create mode 100644 common/xdg/default.nix create mode 100644 common/xdg/mime.nix rename common/{ => xdg}/portals.nix (92%) diff --git a/common/graphics/qt.nix b/common/graphics/qt.nix index 893f063..98ffb8c 100644 --- a/common/graphics/qt.nix +++ b/common/graphics/qt.nix @@ -19,6 +19,7 @@ in xcb-util-cursor qt6ct kdePackages.dolphin + qtwayland ]; environment.pathsToLink = [ diff --git a/common/tooling/default.nix b/common/tooling/default.nix index 8f439b1..43661a2 100644 --- a/common/tooling/default.nix +++ b/common/tooling/default.nix @@ -52,6 +52,11 @@ in nomacs gparted zathura + imhex + libreoffice-qt + filezilla + obsidian + thunderbird ]; programs.git = { @@ -118,6 +123,7 @@ in matplotlib numpy scipy + pygobject3 ]; }; }; diff --git a/common/tooling/nix.nix b/common/tooling/nix.nix index a4177f6..cf90d22 100644 --- a/common/tooling/nix.nix +++ b/common/tooling/nix.nix @@ -18,6 +18,10 @@ in nix-search-cli ]; + environment.sessionVariables = { + NIXPKGS_ALLOW_UNFREE = "1"; + }; + grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [ vim-nix ]; diff --git a/common/xdg/default.nix b/common/xdg/default.nix new file mode 100644 index 0000000..23d1b5d --- /dev/null +++ b/common/xdg/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./portals.nix + ./mime.nix + ]; +} diff --git a/common/xdg/mime.nix b/common/xdg/mime.nix new file mode 100644 index 0000000..c4383ec --- /dev/null +++ b/common/xdg/mime.nix @@ -0,0 +1,76 @@ +{ pkgs, config, lib, ... }: +let + cfg = config.grimmShared; + browsers = [ + "firefox-beta.desktop" + "firefox.desktop" + ]; + text_editors = [ + "nvim.desktop" + "geany.desktop" + "imhex.desktop" + ]; + image_viewers = [ + "org.nomacs.ImageLounge.desktop" + "org.kde.krita.desktop" + "draw.desktop" + ]; + audio_players = [ + "vlc.desktop" + ]; + video_viewers = [ + "vlc.desktop" + ]; + document_viewers = [ + "org.pwmt.zathura-pdf-mupdf.desktop" + "com.github.jeromerobert.pdfarranger.desktop" + ] ++ browsers; + cad = [ + "org.freecadweb.FreeCAD.desktop" + "PrusaSlicer.desktop" + "openscad.desktop" + ]; + tex_editors = [ ] ++ text_editors; +in +{ + config = with cfg; lib.mkIf (enable && portals && graphical) { + xdg.mime.enable = true; + xdg.mime.addedAssociations = { + "application/java-vm" = [ + "idea-community.desktop" + "imhex.desktop" + ]; + "application/json" = text_editors ++ [ + "firefox-beta.desktop" + ]; + "application/mp4" = video_viewers; + "application/ogg" = audio_players; + "application/octet-stream" = "imhex.desktop"; + "application/pdf" = document_viewers; + "application/rss+xml" = text_editors; + "application/x-chess-pgn" = [ ] ++ text_editors; # fixme + "application/x-krita" = "org.kde.krita.desktop"; + "application/x-latex" = tex_editors; + "application/x-tex" = tex_editors; + "application/x-texinfo" = tex_editors; + "application/xml" = text_editors; + "image/svg+xml" = image_viewers ++ browsers ++ text_editors; + "image/*" = image_viewers; + "image/vnd.dwg" = cad; + "model/*" = cad; + "gcode" = [ + "PrusaSlicer.desktop" + ]; + "audio/*" = audio_players; + "text/*" = text_editors; + "text/plain" = text_editors; + "text/markdown" = [ "obsidian.desktop" ] ++ text_editors; + "text/csv" = [ "calc.desktop" ] ++ text_editors; + "text/html" = browsers ++ text_editors; + "text/x-python" = [ "pycharm-community.desktop" ] ++ text_editors; + "text/x-c" = [ "clion.desktop" ] ++ text_editors; + "text/x-java-source" = [ "idea-community.desktop" ] ++ text_editors; + "video/*" = video_viewers; + }; + }; +} diff --git a/common/portals.nix b/common/xdg/portals.nix similarity index 92% rename from common/portals.nix rename to common/xdg/portals.nix index 9108aec..1d150ab 100644 --- a/common/portals.nix +++ b/common/xdg/portals.nix @@ -5,9 +5,11 @@ in { config = with cfg; lib.mkIf (enable && portals) { xdg.icons.enable = true; + xdg.sounds.enable = lib.mkIf sound.enable true; xdg.portal = { enable = true; + xdgOpenUsePortal = true; extraPortals = with pkgs; [ xdg-desktop-portal-wlr xdg-desktop-portal-kde diff --git a/configuration.nix b/configuration.nix index 75c1a00..80e652b 100644 --- a/configuration.nix +++ b/configuration.nix @@ -15,7 +15,7 @@ }; # Enable flatpaks - services.flatpak.enable = true; + # services.flatpak.enable = true; grimmShared = { enable = true; @@ -25,6 +25,7 @@ network = true; tooling = { enable = true; + pass = true; lilypond = true; }; sound = { @@ -60,14 +61,6 @@ mode = "777"; }; - environment.sessionVariables = { - NIXPKGS_ALLOW_UNFREE = "1"; - MOZ_ENABLE_WAYLAND = "1"; - # QT_QPA_PLATFORM="wayland-egl"; - OCI_CLI_RC_FILE = "/home/grimmauld/.oci/config"; - }; - boot.tmp.cleanOnBoot = true; - programs.dconf.enable = true; } diff --git a/load_common.nix b/load_common.nix index 680c376..eecf1e8 100644 --- a/load_common.nix +++ b/load_common.nix @@ -8,7 +8,7 @@ with lib; imports = [ ./common/localisation.nix ./common/printing.nix - ./common/portals.nix + ./common/xdg ./common/network ./common/tooling ./common/sound diff --git a/modules/users.nix b/modules/users.nix index d6babfd..fdca3b4 100644 --- a/modules/users.nix +++ b/modules/users.nix @@ -43,6 +43,7 @@ freecad openscad vlc + arena stable.jetbrains.clion jetbrains.idea-community jetbrains.pycharm-community