2022-05-06 03:01:56 +00:00
|
|
|
{ config, pkgs, lib, ... }: {
|
2022-04-29 02:43:50 +00:00
|
|
|
|
2022-12-21 21:18:03 +00:00
|
|
|
options = {
|
|
|
|
media = {
|
|
|
|
enable = lib.mkEnableOption {
|
|
|
|
description = "Enable media programs.";
|
|
|
|
default = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf (config.gui.enable && config.media.enable) {
|
2023-02-17 23:14:57 +00:00
|
|
|
home-manager.users.${config.user} = {
|
|
|
|
home.packages = with pkgs; [
|
2023-03-19 14:45:52 +00:00
|
|
|
nsxiv # Image viewer
|
2023-02-17 23:14:57 +00:00
|
|
|
mupdf # PDF viewer
|
|
|
|
zathura # PDF viewer
|
|
|
|
];
|
|
|
|
|
2023-03-11 19:14:45 +00:00
|
|
|
# Video player
|
|
|
|
programs.mpv = {
|
|
|
|
enable = true;
|
|
|
|
bindings = { };
|
|
|
|
config = { image-display-duration = 2; };
|
2023-03-25 14:51:20 +00:00
|
|
|
scripts = [
|
|
|
|
|
|
|
|
# Automatically load playlist entries before and after current file
|
|
|
|
pkgs.mpvScripts.autoload
|
|
|
|
|
|
|
|
# Delete current file after quitting
|
|
|
|
(pkgs.stdenv.mkDerivation rec {
|
|
|
|
pname = "mpv-delete-file";
|
|
|
|
version = "0.1"; # made-up
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "zenyd";
|
|
|
|
repo = "mpv-scripts";
|
|
|
|
rev = "19ea069abcb794d1bf8fac2f59b50d71ab992130";
|
|
|
|
sha256 = "sha256-OBCuzCtgfSwj0i/rBNranuu4LRc47jObwQIJgQQoerg=";
|
|
|
|
} + "/delete_file.lua";
|
|
|
|
dontBuild = true;
|
|
|
|
dontUnpack = true;
|
|
|
|
installPhase =
|
|
|
|
"install -Dm644 ${src} $out/share/mpv/scripts/delete_file.lua";
|
|
|
|
passthru.scriptName = "delete_file.lua";
|
|
|
|
})
|
|
|
|
];
|
2023-03-11 19:14:45 +00:00
|
|
|
};
|
|
|
|
|
2023-02-17 23:14:57 +00:00
|
|
|
# Set default for opening PDFs
|
2023-03-09 03:58:49 +00:00
|
|
|
xdg.mimeApps = {
|
|
|
|
associations.added = {
|
|
|
|
"application/pdf" = [ "pwmt.zathura-cb.desktop" ];
|
2023-04-04 01:54:53 +00:00
|
|
|
"image/jpeg" = [ "nsxiv.desktop" ];
|
2023-03-19 14:45:52 +00:00
|
|
|
"image/*" = [ "nsxiv.desktop" ];
|
2023-03-09 03:58:49 +00:00
|
|
|
};
|
2023-04-04 01:54:53 +00:00
|
|
|
associations.removed = {
|
|
|
|
"application/pdf" = [ "mupdf.desktop" "wine-extension-pdf.desktop" ];
|
|
|
|
};
|
2023-03-09 03:58:49 +00:00
|
|
|
defaultApplications = {
|
|
|
|
"application/pdf" = [ "pwmt.zathura-cb.desktop" ];
|
2023-04-04 01:54:53 +00:00
|
|
|
"image/jpeg" = [ "nsxiv.desktop" ];
|
2023-03-19 14:45:52 +00:00
|
|
|
"image/*" = [ "nsxiv.desktop" ];
|
2023-03-09 03:58:49 +00:00
|
|
|
};
|
|
|
|
};
|
2023-02-17 23:14:57 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2022-04-29 02:43:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|