From 9f3c75e547e5d59f67195080f92a2182b33adada Mon Sep 17 00:00:00 2001 From: David Baynard Date: Tue, 20 Aug 2024 22:54:41 +0100 Subject: [PATCH 1/4] Stub media/video --- flake.nix | 2 ++ media/video/default.nix | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 media/video/default.nix diff --git a/flake.nix b/flake.nix index 9461fe1..b022f43 100644 --- a/flake.nix +++ b/flake.nix @@ -54,6 +54,8 @@ ./editors/language-server ./editors/formatter + ./media/video + ./network/tunnel ./utils/email diff --git a/media/video/default.nix b/media/video/default.nix new file mode 100644 index 0000000..b953f67 --- /dev/null +++ b/media/video/default.nix @@ -0,0 +1,28 @@ +{ self, lib, nixpkgs, ... }: + +let + pnames = [ ]; +in +{ + overlays.video = final: prev: + let + extras = { }; + in + lib.foldFor pnames + (pname: { + ${pname} = prev.callPackage + (./. + "/${pname}.nix") + (extras."${pname}" or { }); + }); +} // +lib.foldFor lib.platforms.all (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + packages.${system} = + lib.filterAttrs (_: lib.isDerivation) self.legacyPackages.${system}; + legacyPackages.${system} = self.overlays.video + (pkgs // self.packages.${system}) + pkgs; + }) From b6f4bde90e6864e6a9e853422b8abdf87106e268 Mon Sep 17 00:00:00 2001 From: David Baynard Date: Tue, 20 Aug 2024 23:10:17 +0100 Subject: [PATCH 2/4] Add handbrake GUI version (bin) for darwin --- media/video/default.nix | 2 +- media/video/handbrake-gui-bin.nix | 46 +++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 media/video/handbrake-gui-bin.nix diff --git a/media/video/default.nix b/media/video/default.nix index b953f67..29baf61 100644 --- a/media/video/default.nix +++ b/media/video/default.nix @@ -1,7 +1,7 @@ { self, lib, nixpkgs, ... }: let - pnames = [ ]; + pnames = [ "handbrake-gui-bin" ]; in { overlays.video = final: prev: diff --git a/media/video/handbrake-gui-bin.nix b/media/video/handbrake-gui-bin.nix new file mode 100644 index 0000000..1963e23 --- /dev/null +++ b/media/video/handbrake-gui-bin.nix @@ -0,0 +1,46 @@ +{ lib +, darwin +, fetchurl +, hostPlatform +, handbrake +, stdenvNoCC +, undmg +}: + +let + + inherit (handbrake) pname meta; + version = "1.8.2"; + + src = let name = "${pname}-${version}.dmg"; in + fetchurl + { + inherit name; + urls = [ + "https://github.com/HandBrake/HandBrake/releases/download/${version}/HandBrake-${version}.dmg" + ]; + hash = "sha256-pZ3Ba2qmzlBBZyYgs+6+LlG7MgXkvQpWI1nL8TI7LYQ="; + }; + + handbrakeBin = stdenvNoCC.mkDerivation { + pname = "${pname}-gui"; + inherit src version; + sourceRoot = "."; + + meta = meta // { + platforms = lib.platforms.darwin; + broken = false; + }; + + nativeBuildInputs = [ + undmg + ]; + + installPhase = '' + mkdir -p "$out/Applications/" + cp -pR "HandBrake.app" "$out/Applications/" + ''; + }; + +in +handbrakeBin From f58a70383c9d73872176d61e8dddb70f323fa6c0 Mon Sep 17 00:00:00 2001 From: David Baynard Date: Tue, 20 Aug 2024 23:26:46 +0100 Subject: [PATCH 3/4] Add handbrake CLI version (bin) for darwin --- media/video/default.nix | 2 +- media/video/handbrake-cli-bin.nix | 50 +++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 media/video/handbrake-cli-bin.nix diff --git a/media/video/default.nix b/media/video/default.nix index 29baf61..737b3b2 100644 --- a/media/video/default.nix +++ b/media/video/default.nix @@ -1,7 +1,7 @@ { self, lib, nixpkgs, ... }: let - pnames = [ "handbrake-gui-bin" ]; + pnames = [ "handbrake-cli-bin" "handbrake-gui-bin" ]; in { overlays.video = final: prev: diff --git a/media/video/handbrake-cli-bin.nix b/media/video/handbrake-cli-bin.nix new file mode 100644 index 0000000..75f77f9 --- /dev/null +++ b/media/video/handbrake-cli-bin.nix @@ -0,0 +1,50 @@ +{ lib +, darwin +, fetchurl +, hostPlatform +, handbrake +, stdenvNoCC +, undmg +}: + +let + + inherit (handbrake) pname meta; + version = "1.8.2"; + + src = let name = "${pname}-${version}.dmg"; in + fetchurl + { + inherit name; + urls = [ + "https://github.com/HandBrake/HandBrake/releases/download/${version}/HandBrakeCLI-${version}.dmg" + ]; + hash = "sha256-Tfw9cO9bYMhv2MrIfiF062usMqAfnD6cXiLzyxImRsU="; + }; + + handbrakeCliBin = stdenvNoCC.mkDerivation { + pname = "${pname}-cli"; + inherit src version; + sourceRoot = "."; + + meta = meta // { + platforms = lib.platforms.darwin; + broken = false; + mainProgram = "HandBrakeCLI"; + }; + + nativeBuildInputs = [ + undmg + ]; + + installPhase = '' + mkdir -p "$out/bin" + cp -pR "HandBrakeCLI" "$out/bin/" + + mkdir -p "$out/share/" + cp -pR "doc" "$out/share/" + ''; + }; + +in +handbrakeCliBin From c255d47696789d2a3bf3d51f0d683c7e7318e50a Mon Sep 17 00:00:00 2001 From: David Baynard Date: Tue, 20 Aug 2024 23:35:52 +0100 Subject: [PATCH 4/4] Add wrapper with handbrake CLI and GUI --- media/video/default.nix | 8 ++++++-- media/video/handbrake-bin.nix | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 media/video/handbrake-bin.nix diff --git a/media/video/default.nix b/media/video/default.nix index 737b3b2..cdbf95b 100644 --- a/media/video/default.nix +++ b/media/video/default.nix @@ -1,12 +1,16 @@ { self, lib, nixpkgs, ... }: let - pnames = [ "handbrake-cli-bin" "handbrake-gui-bin" ]; + pnames = [ "handbrake-bin" "handbrake-cli-bin" "handbrake-gui-bin" ]; in { overlays.video = final: prev: let - extras = { }; + extras = { + "handbrake-bin" = { + inherit (final) handbrake-cli-bin handbrake-gui-bin; + }; + }; in lib.foldFor pnames (pname: { diff --git a/media/video/handbrake-bin.nix b/media/video/handbrake-bin.nix new file mode 100644 index 0000000..88f4ddb --- /dev/null +++ b/media/video/handbrake-bin.nix @@ -0,0 +1,21 @@ +{ lib +, handbrake-cli-bin +, handbrake-gui-bin +, handbrake +, symlinkJoin +}: + +let + + inherit (handbrake) pname; + inherit (handbrake-cli-bin) meta; + version = "1.8.2"; + +in +symlinkJoin { + name = "${pname}-${version}"; + inherit pname version meta; + buildInputs = [ ]; + + paths = [ handbrake-cli-bin handbrake-gui-bin ]; +}