From 6662708cd090f072666b340356403e4391eb06d0 Mon Sep 17 00:00:00 2001 From: Aria Edmonds Date: Sun, 20 Jan 2019 12:21:25 +1100 Subject: [PATCH 1/2] pb_cli: init at 1.0 --- pkgs/tools/misc/pb_cli/0001-eval-fix.patch | 10 ++++++ pkgs/tools/misc/pb_cli/default.nix | 40 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 3 files changed, 52 insertions(+) create mode 100644 pkgs/tools/misc/pb_cli/0001-eval-fix.patch create mode 100644 pkgs/tools/misc/pb_cli/default.nix diff --git a/pkgs/tools/misc/pb_cli/0001-eval-fix.patch b/pkgs/tools/misc/pb_cli/0001-eval-fix.patch new file mode 100644 index 000000000000..7188cf372977 --- /dev/null +++ b/pkgs/tools/misc/pb_cli/0001-eval-fix.patch @@ -0,0 +1,10 @@ +diff --git a/src/pb.sh b/src/pb.sh +index be1e472..eb9e6f9 100755 +--- a/src/pb.sh ++++ b/src/pb.sh +@@ -61,4 +61,4 @@ pb () { + esac + } + +-eval " ${0##*/}" "$@" ++pb "$@" diff --git a/pkgs/tools/misc/pb_cli/default.nix b/pkgs/tools/misc/pb_cli/default.nix new file mode 100644 index 000000000000..6fab44891c52 --- /dev/null +++ b/pkgs/tools/misc/pb_cli/default.nix @@ -0,0 +1,40 @@ +{ screenshots ? true, video ? false, clipboard ? true +, stdenv, pkgs, jq, curl, fetchFromGitHub, makeWrapper, maim ? null, xclip ? null, capture ? null }: + +assert screenshots -> maim != null; +assert video -> capture != null; +assert clipboard -> xclip != null; + +stdenv.mkDerivation rec { + name = "pb_cli-${version}"; + version = "1.0"; + + src = fetchFromGitHub { + owner = "ptpb"; + repo = "pb_cli"; + rev = "5242382b3d6b5c0ddaf6e4843a69746b40866e57"; + sha256 = "0543x3377apinhxnsfq82zlp5sm8g1bf6hmsvvcwra5rsshv2ybk"; + }; + + patches = [ ./0001-eval-fix.patch ]; + + buildInputs = [ makeWrapper ]; + + liveDeps = [ jq curl ] ++ stdenv.lib.optional screenshots maim + ++ stdenv.lib.optional video capture + ++ stdenv.lib.optional clipboard xclip; + + installPhase = '' + install -Dm755 src/pb.sh $out/bin/pb + + patchShebangs $out/bin/pb + wrapProgram $out/bin/pb \ + --prefix PATH : '${stdenv.lib.makeBinPath liveDeps}' + ''; + + meta = with stdenv.lib; { + description = "A no bullshit ptpb client"; + homepage = "https://github.com/ptpb/pb_cli"; + maintainers = [ maintainers.ar1a ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6a0c3b98a179..17d53150a0d3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18711,6 +18711,8 @@ in packet = callPackage ../development/tools/packet { }; + pb_cli = callPackage ../tools/misc/pb_cli {}; + pbrt = callPackage ../applications/graphics/pbrt { }; pcsxr = callPackage ../misc/emulators/pcsxr { From 2fa2d55bed1593e434f39ebc4d91fc0c82d46551 Mon Sep 17 00:00:00 2001 From: Aria Edmonds Date: Sun, 20 Jan 2019 12:31:41 +1100 Subject: [PATCH 2/2] capture: init at 1.0 --- pkgs/tools/misc/capture/0001-eval-fix.patch | 10 ++++++ .../misc/capture/0002-sane-defaults.patch | 22 +++++++++++++ pkgs/tools/misc/capture/default.nix | 31 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 4 files changed, 65 insertions(+) create mode 100644 pkgs/tools/misc/capture/0001-eval-fix.patch create mode 100644 pkgs/tools/misc/capture/0002-sane-defaults.patch create mode 100644 pkgs/tools/misc/capture/default.nix diff --git a/pkgs/tools/misc/capture/0001-eval-fix.patch b/pkgs/tools/misc/capture/0001-eval-fix.patch new file mode 100644 index 000000000000..4b5bdc6a0bcf --- /dev/null +++ b/pkgs/tools/misc/capture/0001-eval-fix.patch @@ -0,0 +1,10 @@ +diff --git a/src/capture.sh b/src/capture.sh +index a32b018..82d1f15 100755 +--- a/src/capture.sh ++++ b/src/capture.sh +@@ -103,4 +103,4 @@ capture () { + + + # remove this line if you want to source this file instead +-eval " ${0##*/}" "$@" ++capture "$@" diff --git a/pkgs/tools/misc/capture/0002-sane-defaults.patch b/pkgs/tools/misc/capture/0002-sane-defaults.patch new file mode 100644 index 000000000000..1bd49ae41e38 --- /dev/null +++ b/pkgs/tools/misc/capture/0002-sane-defaults.patch @@ -0,0 +1,22 @@ +diff --git a/src/capture.sh b/src/capture.sh +index a32b018..42f3936 100755 +--- a/src/capture.sh ++++ b/src/capture.sh +@@ -9,7 +9,7 @@ set -e + # + + scale="-1:-1" +-fps="15" ++fps="30" + raw_video="-vf fps=$fps -c:v utvideo -f nut" + raw_video_container=".nut" + +@@ -18,7 +18,7 @@ raw_video_container=".nut" + # https://stackoverflow.com/questions/41372045/vp9-encoding-limited-to-4-threads + webm_video="-pix_fmt yuv420p -c:v libvpx-vp9 -crf 25 -b:v 0 -f webm -tile-columns 6 -frame-parallel 1 -threads 8" + +-tmpdir="/var/tmp" ++tmpdir="/tmp" + + + # capture_raw ./foo.nut diff --git a/pkgs/tools/misc/capture/default.nix b/pkgs/tools/misc/capture/default.nix new file mode 100644 index 000000000000..49c238b0bd0f --- /dev/null +++ b/pkgs/tools/misc/capture/default.nix @@ -0,0 +1,31 @@ +{ stdenv, pkgs, slop, ffmpeg, fetchFromGitHub, makeWrapper}: + +stdenv.mkDerivation rec { + name = "capture-${version}"; + version = "1.0"; + + src = fetchFromGitHub { + owner = "buhman"; + repo = "capture"; + rev = "4be986f17462b8d520559429c74da6bf3a436259"; + sha256 = "172y06vs993x5v78zwl81xma1gkvjq1ad9rvmf3a217fyxsz4nhh"; + }; + + buildInputs = [ makeWrapper ]; + + patches = [ ./0001-eval-fix.patch ./0002-sane-defaults.patch ]; + + installPhase = '' + install -Dm755 src/capture.sh $out/bin/capture + + patchShebangs $out/bin/capture + wrapProgram $out/bin/capture \ + --prefix PATH : '${stdenv.lib.makeBinPath [ slop ffmpeg ]}' + ''; + + meta = with stdenv.lib; { + description = "A no bullshit screen capture tool"; + homepage = "https://github.com/buhman/capture"; + maintainers = [ maintainers.ar1a ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 17d53150a0d3..d331fb88beb0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18713,6 +18713,8 @@ in pb_cli = callPackage ../tools/misc/pb_cli {}; + capture = callPackage ../tools/misc/capture {}; + pbrt = callPackage ../applications/graphics/pbrt { }; pcsxr = callPackage ../misc/emulators/pcsxr {