programs: factor out a sane.programs.<foo>.mime
schema
This commit is contained in:
parent
d459dd0f85
commit
55d64eb598
|
@ -1,46 +1,14 @@
|
||||||
{ config, ...}:
|
{ config, lib, ...}:
|
||||||
|
|
||||||
let
|
|
||||||
# TODO: should move all of this into `sane.programs` to not ship broken associations
|
|
||||||
www = config.sane.programs.web-browser.config.browser.desktop;
|
|
||||||
pdf = "org.gnome.Evince.desktop";
|
|
||||||
md = "obsidian.desktop";
|
|
||||||
thumb = "org.gnome.gThumb.desktop";
|
|
||||||
video = "vlc.desktop";
|
|
||||||
# audio = "mpv.desktop";
|
|
||||||
audio = "vlc.desktop";
|
|
||||||
email = "aerc.desktop";
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
|
||||||
# the xdg mime type for a file can be found with:
|
# the xdg mime type for a file can be found with:
|
||||||
# - `xdg-mime query filetype path/to/thing.ext`
|
# - `xdg-mime query filetype path/to/thing.ext`
|
||||||
# we can have single associations or a list of associations.
|
# we can have single associations or a list of associations.
|
||||||
# there's also options to *remove* [non-default] associations from specific apps
|
# there's also options to *remove* [non-default] associations from specific apps
|
||||||
xdg.mime.enable = true;
|
xdg.mime.enable = true;
|
||||||
xdg.mime.defaultApplications = {
|
xdg.mime.defaultApplications = lib.mkMerge (
|
||||||
# AUDIO
|
builtins.map
|
||||||
"audio/flac" = audio;
|
(p: lib.mkIf p.enabled p.mime)
|
||||||
"audio/mpeg" = audio;
|
(builtins.attrValues config.sane.programs)
|
||||||
"audio/x-vorbis+ogg" = audio;
|
);
|
||||||
# IMAGES
|
|
||||||
"image/heif" = thumb; # apple codec
|
|
||||||
"image/png" = thumb;
|
|
||||||
"image/jpeg" = thumb;
|
|
||||||
# VIDEO
|
|
||||||
"video/mp4" = video;
|
|
||||||
"video/quicktime" = video;
|
|
||||||
"video/webm" = video;
|
|
||||||
"video/x-matroska" = video;
|
|
||||||
# HTML
|
|
||||||
"text/html" = www;
|
|
||||||
"x-scheme-handler/http" = www;
|
|
||||||
"x-scheme-handler/https" = www;
|
|
||||||
"x-scheme-handler/about" = www;
|
|
||||||
"x-scheme-handler/unknown" = www;
|
|
||||||
# RICH-TEXT DOCUMENTS
|
|
||||||
"application/pdf" = pdf;
|
|
||||||
"text/markdown" = md;
|
|
||||||
"x-scheme-handler/mailto" = email;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,5 +2,8 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
sane.programs.aerc.secrets.".config/aerc/accounts.conf" = ../../../secrets/common/aerc_accounts.conf.bin;
|
sane.programs.aerc = {
|
||||||
|
secrets.".config/aerc/accounts.conf" = ../../../secrets/common/aerc_accounts.conf.bin;
|
||||||
|
mime."x-scheme-handler/mailto" = "aerc.desktop";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
./assorted.nix
|
./assorted.nix
|
||||||
./cozy.nix
|
./cozy.nix
|
||||||
./epiphany.nix
|
./epiphany.nix
|
||||||
|
./evince.nix
|
||||||
./fontconfig.nix
|
./fontconfig.nix
|
||||||
./git.nix
|
./git.nix
|
||||||
./gnome-feeds.nix
|
./gnome-feeds.nix
|
||||||
|
@ -25,6 +26,7 @@
|
||||||
./neovim.nix
|
./neovim.nix
|
||||||
./newsflash.nix
|
./newsflash.nix
|
||||||
./nix-index.nix
|
./nix-index.nix
|
||||||
|
./obsidian.nix
|
||||||
./offlineimap.nix
|
./offlineimap.nix
|
||||||
./ripgrep.nix
|
./ripgrep.nix
|
||||||
./sfeed.nix
|
./sfeed.nix
|
||||||
|
|
4
hosts/common/programs/evince.nix
Normal file
4
hosts/common/programs/evince.nix
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
sane.programs.evince.mime."application/pdf" = "org.gnome.Evince.desktop";
|
||||||
|
}
|
|
@ -1,4 +1,10 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
sane.programs.gthumb.package = pkgs.gthumb.override { withWebservices = false; };
|
sane.programs.gthumb = {
|
||||||
|
# compile without webservices to avoid the expensive webkitgtk dependency
|
||||||
|
package = pkgs.gthumb.override { withWebservices = false; };
|
||||||
|
mime."image/heif" = "org.gnome.gThumb.desktop"; # apple codec
|
||||||
|
mime."image/png" = "org.gnome.gThumb.desktop";
|
||||||
|
mime."image/jpeg" = "org.gnome.gThumb.desktop";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
4
hosts/common/programs/obsidian.nix
Normal file
4
hosts/common/programs/obsidian.nix
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
sane.programs.obsidian.mime."text/markdown" = "obsidian.desktop";
|
||||||
|
}
|
|
@ -25,5 +25,13 @@ in
|
||||||
[qt]
|
[qt]
|
||||||
qt-privacy-ask=0
|
qt-privacy-ask=0
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
mime."audio/flac" = "vlc.desktop";
|
||||||
|
mime."audio/mpeg" = "vlc.desktop";
|
||||||
|
mime."audio/x-vorbis+ogg" = "vlc.desktop";
|
||||||
|
mime."video/mp4" = "vlc.desktop";
|
||||||
|
mime."video/quicktime" = "vlc.desktop";
|
||||||
|
mime."video/webm" = "vlc.desktop";
|
||||||
|
mime."video/x-matroska" = "vlc.desktop";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,6 +193,16 @@ in
|
||||||
sane.programs.web-browser = {
|
sane.programs.web-browser = {
|
||||||
inherit package;
|
inherit package;
|
||||||
|
|
||||||
|
mime = let
|
||||||
|
inherit (cfg.browser) desktop;
|
||||||
|
in {
|
||||||
|
"text/html" = desktop;
|
||||||
|
"x-scheme-handler/http" = desktop;
|
||||||
|
"x-scheme-handler/https" = desktop;
|
||||||
|
"x-scheme-handler/about" = desktop;
|
||||||
|
"x-scheme-handler/unknown" = desktop;
|
||||||
|
};
|
||||||
|
|
||||||
# env.BROWSER = "${package}/bin/${cfg.browser.libName}";
|
# env.BROWSER = "${package}/bin/${cfg.browser.libName}";
|
||||||
env.BROWSER = cfg.browser.libName; # used by misc tools like xdg-email, as fallback
|
env.BROWSER = cfg.browser.libName; # used by misc tools like xdg-email, as fallback
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,19 @@ let
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
|
mime = mkOption {
|
||||||
|
type = types.attrsOf types.str;
|
||||||
|
default = {};
|
||||||
|
description = ''
|
||||||
|
mime associations. each entry takes the form of:
|
||||||
|
"<mime type>" = "<launcher>.desktop"
|
||||||
|
e.g.
|
||||||
|
{
|
||||||
|
"audio/flac" = "vlc.desktop";
|
||||||
|
"application/pdf" = "org.gnome.Evince.desktop";
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
persist = mkOption {
|
persist = mkOption {
|
||||||
type = options.sane.persist.sys.type;
|
type = options.sane.persist.sys.type;
|
||||||
default = {};
|
default = {};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user