From 187cc904bc47353033dfb1613988d3b02d08ace8 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Sat, 20 Mar 2021 21:07:37 +0100 Subject: [PATCH] mpv: Move pitchcontrol script to overlay --- pkgs/default.nix | 4 +++ pkgs/mpv-scripts/pitchcontrol/default.nix | 31 +++++++++++++++++++++++ users/simon/modules/mpv.nix | 24 ++---------------- 3 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 pkgs/mpv-scripts/pitchcontrol/default.nix diff --git a/pkgs/default.nix b/pkgs/default.nix index 38192db..46a0a84 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -33,6 +33,10 @@ in ]; }); + mpvScripts = (super.mpvScripts or { }) // { + pitchcontrol = super.callPackage ./mpv-scripts/pitchcontrol { }; + }; + # TODO: Remove patch once mako > 1.4.1 is released and in nixpkgs mako = super.mako.overrideAttrs (o: o // { patches = [ diff --git a/pkgs/mpv-scripts/pitchcontrol/default.nix b/pkgs/mpv-scripts/pitchcontrol/default.nix new file mode 100644 index 0000000..c7b200f --- /dev/null +++ b/pkgs/mpv-scripts/pitchcontrol/default.nix @@ -0,0 +1,31 @@ +{ lib, stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "pitchcontrol"; + version = "0.2.0"; + + src = fetchFromGitHub { + owner = "FichteFoll"; + repo = "mpv-scripts"; + rev = "784dbafcd26455dde22175a5668c621defc14cab"; + sha256 = "057vslm6ybf0b0a5s39m049pcvb204hqf6jx1640ya2r6sm335g8"; + }; + + dontBuild = true; + + installPhase = '' + runHook preInstall + install -D ${passthru.scriptName} $out/share/mpv/scripts/${passthru.scriptName} + runHook postInstall + ''; + + passthru.scriptName = "${pname}.lua"; + + meta = with lib; { + description = "An mpv script to change the pitch of audio with keybindings"; + homepage = "https://github.com/FichteFoll/mpv-scripts"; + license = licenses.isc; + platforms = platforms.all; + maintainers = with maintainers; [ sbruder ]; + }; +} diff --git a/users/simon/modules/mpv.nix b/users/simon/modules/mpv.nix index 05962d2..926d16c 100644 --- a/users/simon/modules/mpv.nix +++ b/users/simon/modules/mpv.nix @@ -32,25 +32,6 @@ let }; }; - pitchcontrol = (pkgs.stdenvNoCC.mkDerivation rec { - name = "pitchcontrol.lua"; - scriptName = name; - - src = pkgs.fetchFromGitHub { - owner = "FichteFoll"; - repo = "mpv-scripts"; - rev = "28ce548e82460b1ca40d3d0149faffff97c874a0"; - sha256 = "159bbkk0jj25msqyg0wq5w152g6rvm325nzg0b68qzsszz73bw5p"; - }; - - installPhase = '' - mkdir -p $out/share/mpv/scripts/ - cp pitchcontrol.lua $out/share/mpv/scripts - ''; - - meta.license = lib.licenses.isc; - }); - gallery-view = pkgs.fetchFromGitHub { owner = "occivink"; repo = "mpv-gallery-view"; @@ -220,11 +201,10 @@ in clear-speed.af-add = "scaletempo=stride=18:overlap=.6:search=10"; }; - scripts = [ + scripts = with pkgs.mpvScripts; [ pitchcontrol - ] ++ (with pkgs.mpvScripts; [ sponsorblock - ]); + ]; }; # mpv-gallery-view is not compatible with home-manager’s script injection meachanism