summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archetypes/profiles/desktop/default.nix2
-rw-r--r--home-manager/clone-repos.nix7
-rw-r--r--home-manager/default.nix1
-rw-r--r--home-manager/resources/xdg-mime/mpv120
-rw-r--r--home-manager/resources/xdg-mime/nvim15
-rw-r--r--home-manager/resources/xdg-mime/org.pwmt.zathura-pdf-mupdf4
-rw-r--r--home-manager/resources/xdg-mime/sxiv14
-rw-r--r--home-manager/resources/xdg-mime/thunderbird3
-rw-r--r--home-manager/xdg-mime.nix23
9 files changed, 182 insertions, 7 deletions
diff --git a/archetypes/profiles/desktop/default.nix b/archetypes/profiles/desktop/default.nix
index 7ca1e7c..499de17 100644
--- a/archetypes/profiles/desktop/default.nix
+++ b/archetypes/profiles/desktop/default.nix
@@ -71,6 +71,8 @@
enable = mkDesktop true;
desktop = mkDesktop true;
};
+
+ xdg.mimeApps._setDefaultApplications.enable = true;
};
in {
imports = [ (lib._mkProfileArchetype "desktop" nixosConfig homeConfig) ];
diff --git a/home-manager/clone-repos.nix b/home-manager/clone-repos.nix
index ef5bdb4..fcf96f7 100644
--- a/home-manager/clone-repos.nix
+++ b/home-manager/clone-repos.nix
@@ -31,13 +31,6 @@ in {
linkZshProfile = lib.hm.dag.entryAfter ["writeBoundary"] ''
run ln -sf $VERBOSE_ARG ${dotConfig}/zsh/zprofile $HOME/.zprofile
'';
-
- # TODO look into xdg.mimeApps.defaultApplications
- #mimewiz = lib.mkIf cfg.desktop (lib.hm.dag.entryAfter ["writeBoundary"] ''
- # export PATH="${pkgs.xdg-utils}/bin:$PATH"
- # export PATH="${dotConfig}/misc:$PATH"
- # run mimewiz -i # already verbose
- #'');
};
#home.file.Zprofile = {
# source = "${dotConfig}/zsh/zprofile";
diff --git a/home-manager/default.nix b/home-manager/default.nix
index 26c97c2..da8d936 100644
--- a/home-manager/default.nix
+++ b/home-manager/default.nix
@@ -9,6 +9,7 @@
./qt-gtk-theme.nix
./theme-st.nix
./wallpapers.nix
+ ./xdg-mime.nix
];
# Let Home Manager install and manage itself.
diff --git a/home-manager/resources/xdg-mime/mpv b/home-manager/resources/xdg-mime/mpv
new file mode 100644
index 0000000..697e71b
--- /dev/null
+++ b/home-manager/resources/xdg-mime/mpv
@@ -0,0 +1,120 @@
+application/mxf
+application/ogg
+application/sdp
+application/smil
+application/streamingmedia
+application/vnd.apple.mpegurl
+application/vnd.ms-asf
+application/vnd.rn-realmedia
+application/vnd.rn-realmedia-vbr
+application/x-cue
+application/x-extension-m4a
+application/x-extension-mp4
+application/x-matroska
+application/x-mpegurl
+application/x-ogg
+application/x-ogm
+application/x-ogm-audio
+application/x-ogm-video
+application/x-shorten
+application/x-smil
+application/x-streamingmedia
+audio/3gpp
+audio/3gpp2
+audio/AMR
+audio/aac
+audio/ac3
+audio/aiff
+audio/amr-wb
+audio/dv
+audio/eac3
+audio/flac
+audio/m3u
+audio/m4a
+audio/mp1
+audio/mp2
+audio/mp3
+audio/mp4
+audio/mpeg
+audio/mpeg2
+audio/mpeg3
+audio/mpegurl
+audio/mpg
+audio/musepack
+audio/ogg
+audio/opus
+audio/rn-mpeg
+audio/scpls
+audio/vnd.dolby.heaac.1
+audio/vnd.dolby.heaac.2
+audio/vnd.dts
+audio/vnd.dts.hd
+audio/vnd.rn-realaudio
+audio/vorbis
+audio/wav
+audio/webm
+audio/x-aac
+audio/x-adpcm
+audio/x-aiff
+audio/x-ape
+audio/x-m4a
+audio/x-matroska
+audio/x-mp1
+audio/x-mp2
+audio/x-mp3
+audio/x-mpegurl
+audio/x-mpg
+audio/x-ms-asf
+audio/x-ms-wma
+audio/x-musepack
+audio/x-pls
+audio/x-pn-au
+audio/x-pn-realaudio
+audio/x-pn-wav
+audio/x-pn-windows-pcm
+audio/x-realaudio
+audio/x-scpls
+audio/x-shorten
+audio/x-tta
+audio/x-vorbis
+audio/x-vorbis+ogg
+audio/x-wav
+audio/x-wavpack
+video/3gp
+video/3gpp
+video/3gpp2
+video/avi
+video/divx
+video/dv
+video/fli
+video/flv
+video/mkv
+video/mp2t
+video/mp4
+video/mp4v-es
+video/mpeg
+video/msvideo
+video/ogg
+video/quicktime
+video/vnd.divx
+video/vnd.mpegurl
+video/vnd.rn-realvideo
+video/webm
+video/x-avi
+video/x-flc
+video/x-flic
+video/x-flv
+video/x-m4v
+video/x-matroska
+video/x-mpeg2
+video/x-mpeg3
+video/x-ms-afs
+video/x-ms-asf
+video/x-ms-wmv
+video/x-ms-wmx
+video/x-ms-wvxvideo
+video/x-msvideo
+video/x-ogm
+video/x-ogm+ogg
+video/x-theora
+video/x-theora+ogg
diff --git a/home-manager/resources/xdg-mime/nvim b/home-manager/resources/xdg-mime/nvim
new file mode 100644
index 0000000..709cb57
--- /dev/null
+++ b/home-manager/resources/xdg-mime/nvim
@@ -0,0 +1,15 @@
+application/x-shellscript
+text/english
+text/plain
+text/x-c
+text/x-c++
+text/x-c++hdr
+text/x-c++src
+text/x-chdr
+text/x-csrc
+text/x-java
+text/x-makefile
+text/x-moc
+text/x-pascal
+text/x-tcl
+text/x-tex
diff --git a/home-manager/resources/xdg-mime/org.pwmt.zathura-pdf-mupdf b/home-manager/resources/xdg-mime/org.pwmt.zathura-pdf-mupdf
new file mode 100644
index 0000000..73bd5d0
--- /dev/null
+++ b/home-manager/resources/xdg-mime/org.pwmt.zathura-pdf-mupdf
@@ -0,0 +1,4 @@
+application/epub+zip
+application/oxps
+application/pdf
+application/x-fictionbook
diff --git a/home-manager/resources/xdg-mime/sxiv b/home-manager/resources/xdg-mime/sxiv
new file mode 100644
index 0000000..4401ebb
--- /dev/null
+++ b/home-manager/resources/xdg-mime/sxiv
@@ -0,0 +1,14 @@
+image/bmp
+image/gif
+image/jpeg
+image/jpg
+image/png
+image/tiff
+image/x-bmp
+image/x-portable-anymap
+image/x-portable-bitmap
+image/x-portable-graymap
+image/x-tga
+image/x-xpixmap
+image/svg+xml
+image/svg+xml-compressed
diff --git a/home-manager/resources/xdg-mime/thunderbird b/home-manager/resources/xdg-mime/thunderbird
new file mode 100644
index 0000000..adbec40
--- /dev/null
+++ b/home-manager/resources/xdg-mime/thunderbird
@@ -0,0 +1,3 @@
+message/rfc822
+x-scheme-handler/mailto
+x-scheme-handler/mid
diff --git a/home-manager/xdg-mime.nix b/home-manager/xdg-mime.nix
new file mode 100644
index 0000000..043b214
--- /dev/null
+++ b/home-manager/xdg-mime.nix
@@ -0,0 +1,23 @@
+{ config, lib, pkgs, ... }: let
+ cfg = config.xdg.mimeApps._setDefaultApplications;
+ mimeDir = ./resources/xdg-mime;
+
+ getApplicationMimeTypes = applicationName: lib.filter (s: s != "") (lib.splitString "\n" (builtins.readFile "${mimeDir}/${applicationName}"));
+
+ getMimeTypeApplicationList = applicationName: lib.mkMerge (lib.map (mimetype:
+ { "${mimetype}" = [ "${applicationName}.desktop" ]; }
+ ) (getApplicationMimeTypes applicationName));
+
+ defaultApplications = lib.mkMerge (lib.mapAttrsToList (appPath: pathType: lib.mkIf (pathType == "regular") (getMimeTypeApplicationList appPath)) (builtins.readDir mimeDir));
+in {
+ options.xdg.mimeApps._setDefaultApplications = {
+ enable = lib.mkEnableOption "set default applications as defined in the resources dir";
+ };
+
+ config = lib.mkIf cfg.enable {
+ xdg.mimeApps = {
+ enable = true;
+ inherit defaultApplications;
+ };
+ };
+}