about summary refs log tree commit diff
path: root/modules/nixos/mpv.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/nixos/mpv.nix160
1 files changed, 82 insertions, 78 deletions
diff --git a/modules/nixos/mpv.nix b/modules/nixos/mpv.nix
index efe1729..a2b73fa 100644
--- a/modules/nixos/mpv.nix
+++ b/modules/nixos/mpv.nix
@@ -7,83 +7,87 @@ with lib; let
   cfg = config.nixfiles.modules.mpv;
 in {
   config = mkIf cfg.enable {
-    nixfiles.modules.common.xdg.defaultApplications.mpv = let
-      audio = [
-        "audio/aac"
-        "audio/ac3"
-        "audio/basic"
-        "audio/flac"
-        "audio/midi"
-        "audio/mp4"
-        "audio/mpeg"
-        "audio/ogg"
-        "audio/opus"
-        "audio/vnd.dts"
-        "audio/vnd.dts.hd"
-        "audio/webm"
-        "audio/x-adpcm"
-        "audio/x-aifc"
-        "audio/x-aiff"
-        "audio/x-ape"
-        "audio/x-flac+ogg"
-        "audio/x-m4b"
-        "audio/x-m4r"
-        "audio/x-matroska"
-        "audio/x-mpegurl"
-        "audio/x-musepack"
-        "audio/x-opus+ogg"
-        "audio/x-speex"
-        "audio/x-speex+ogg"
-        "audio/x-vorbis+ogg"
-        "audio/x-wav"
-        "audio/x-wavpack"
-        "x-content/audio-cdda"
-        "x-content/audio-dvd"
-      ];
-      video = [
-        "video/3gpp"
-        "video/3gpp2"
-        "video/mkv"
-        "video/mp2t"
-        "video/mp4"
-        "video/mpeg"
-        "video/ogg"
-        "video/quicktime"
-        "video/vnd.mpegurl"
-        "video/vnd.radgamettools.bink"
-        "video/vnd.radgamettools.smacker"
-        "video/wavelet"
-        "video/webm"
-        "video/x-matroska"
-        "video/x-matroska-3d"
-        "video/x-mjpeg"
-        "video/x-msvideo"
-        "video/x-ogm+ogg"
-        "video/x-theora+ogg"
-        "x-content/video-bluray"
-        "x-content/video-dvd"
-        "x-content/video-hddvd"
-        "x-content/video-svcd"
-        "x-content/video-vcd"
-      ];
-      image = [
-        "image/avif"
-        "image/bmp"
-        "image/gif"
-        "image/jp2"
-        "image/jpeg"
-        "image/jpg"
-        "image/jpm"
-        "image/jpx"
-        "image/jxl"
-        "image/png"
-        "image/tiff"
-        "image/vnd.microsoft.icon"
-        "image/webp"
-        "image/webp"
-        "image/x-tga"
-      ];
-    in
-      audio ++ video ++ image;
+    nixfiles.modules.common = {
+      shell.aliases.cam = "mpv av://v4l2:/dev/video0";
+
+      xdg.defaultApplications.mpv = let
+        audio = [
+          "audio/aac"
+          "audio/ac3"
+          "audio/basic"
+          "audio/flac"
+          "audio/midi"
+          "audio/mp4"
+          "audio/mpeg"
+          "audio/ogg"
+          "audio/opus"
+          "audio/vnd.dts"
+          "audio/vnd.dts.hd"
+          "audio/webm"
+          "audio/x-adpcm"
+          "audio/x-aifc"
+          "audio/x-aiff"
+          "audio/x-ape"
+          "audio/x-flac+ogg"
+          "audio/x-m4b"
+          "audio/x-m4r"
+          "audio/x-matroska"
+          "audio/x-mpegurl"
+          "audio/x-musepack"
+          "audio/x-opus+ogg"
+          "audio/x-speex"
+          "audio/x-speex+ogg"
+          "audio/x-vorbis+ogg"
+          "audio/x-wav"
+          "audio/x-wavpack"
+          "x-content/audio-cdda"
+          "x-content/audio-dvd"
+        ];
+        video = [
+          "video/3gpp"
+          "video/3gpp2"
+          "video/mkv"
+          "video/mp2t"
+          "video/mp4"
+          "video/mpeg"
+          "video/ogg"
+          "video/quicktime"
+          "video/vnd.mpegurl"
+          "video/vnd.radgamettools.bink"
+          "video/vnd.radgamettools.smacker"
+          "video/wavelet"
+          "video/webm"
+          "video/x-matroska"
+          "video/x-matroska-3d"
+          "video/x-mjpeg"
+          "video/x-msvideo"
+          "video/x-ogm+ogg"
+          "video/x-theora+ogg"
+          "x-content/video-bluray"
+          "x-content/video-dvd"
+          "x-content/video-hddvd"
+          "x-content/video-svcd"
+          "x-content/video-vcd"
+        ];
+        image = [
+          "image/avif"
+          "image/bmp"
+          "image/gif"
+          "image/jp2"
+          "image/jpeg"
+          "image/jpg"
+          "image/jpm"
+          "image/jpx"
+          "image/jxl"
+          "image/png"
+          "image/tiff"
+          "image/vnd.microsoft.icon"
+          "image/webp"
+          "image/webp"
+          "image/x-tga"
+        ];
+      in
+        audio ++ video ++ image;
+    };
   };
 }

Consider giving Nix/NixOS a try! <3