From c83b9d5d323017d9f56a9cc31dc2122141cecf72 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Tue, 20 Jun 2023 01:39:19 +0200 Subject: [PATCH] mpv-webm --- flake.nix | 13 +++++++++++-- pkgs/mpv-webm.nix | 28 ++++++++++++++++++++++++++++ users/pbsds/home/profiles/mpv.nix | 9 +++++++-- 3 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 pkgs/mpv-webm.nix diff --git a/flake.nix b/flake.nix index 2031676..9000fef 100644 --- a/flake.nix +++ b/flake.nix @@ -67,8 +67,15 @@ }; mkConfig = hostname: system: modules: nixlib.nixosSystem { inherit system; - specialArgs = { inherit inputs; }; + specialArgs = { + inherit inputs; + packages = self.packages.${system}; + }; modules = modules ++ [ ./base.nix "${self}/hosts/${hostname}" tmpConfig ({ + home-manager.extraSpecialArgs = { + inherit inputs; + packages = self.packages.${system}; + }; networking.hostName = hostname; networking.domain = "pbsds.net"; networking.search = [ "pbsds.net" ]; @@ -96,6 +103,7 @@ inherit inputs; packages = forAllSystems({ pkgs, ... }: { + mpv-webm = pkgs.callPackage ./pkgs/mpv-webm.nix {}; remote-exec = pkgs.python3Packages.callPackage "${inputs.pr-remote-exec}/pkgs/tools/misc/remote-exec" {}; }); @@ -107,9 +115,10 @@ sopp = mkConfig "sopp" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel common-gpu-nvidia-nonprime ]); }; - homeConfigurations = forAllSystems ({ pkgs, ... }: let + homeConfigurations = forAllSystems ({ pkgs, system, ... }: let mkHome = modules: home-manager.lib.homeManagerConfiguration { inherit pkgs modules; + extraSpecialArgs = { packages = self.packages.${system}; }; }; in { pbsds = mkHome [ ./users/pbsds/home ]; diff --git a/pkgs/mpv-webm.nix b/pkgs/mpv-webm.nix new file mode 100644 index 0000000..dd0f96c --- /dev/null +++ b/pkgs/mpv-webm.nix @@ -0,0 +1,28 @@ +{ lib +, stdenvNoCC +, fetchFromGitHub +, luaPackages +}: + +stdenvNoCC.mkDerivation { + pname = "mpv-webm"; + version = "unstable-2023-02-23"; + src = fetchFromGitHub { + owner = "ekisu"; + repo = "mpv-webm"; + rev = "a18375932e39e9b2a40d9c7ab52ea367b41e2558"; + hash = "sha256-aetkQ1gU/6Yys5FJS/N06ED9tCSvL6BAgUGdNmNmpbU="; + }; + + nativeBuildInputs = [ luaPackages.moonscript ]; + + installPhase = '' + runHook preInstall + mkdir -p $out/share/mpv/scripts + install -m 644 build/webm.lua $out/share/mpv/scripts/ + runHook postInstall + ''; + + passthru.scriptName = "webm.lua"; + +} diff --git a/users/pbsds/home/profiles/mpv.nix b/users/pbsds/home/profiles/mpv.nix index 4c26cab..25c0c0e 100644 --- a/users/pbsds/home/profiles/mpv.nix +++ b/users/pbsds/home/profiles/mpv.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, packages, ... }: { #home.packages = with pkgs; [ mpv ]; @@ -7,7 +7,12 @@ programs.mpv.bindings."SHIFT+n" = "sub-seek -1"; programs.mpv.bindings."b" = ''cycle-values audio-channels 2 "auto"''; - #programs.mpv.scripts = with pkgs.mpvScripts; [ thumbnail mpris ]; + programs.mpv.scripts = with pkgs.mpvScripts; [ + #thumbnail # TOO SLOW + #mpris + # TODO: thumbfast + packages.mpv-webm # activate with SHIFT+w + ]; #programs.mpv.config.osc = "no"; # likely a 'thumbnail' requirement #https://nixos.wiki/wiki/Accelerated_Video_Playback