Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pb cli and capture initialization #54349

Merged
merged 2 commits into from
Jan 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkgs/tools/misc/capture/0001-eval-fix.patch
Original file line number Diff line number Diff line change
@@ -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 "$@"
22 changes: 22 additions & 0 deletions pkgs/tools/misc/capture/0002-sane-defaults.patch
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions pkgs/tools/misc/capture/default.nix
Original file line number Diff line number Diff line change
@@ -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 ]}'
'';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent the text between '' quotes two spaces (same on the other package).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do the patching and wrapping before the install call, ideally within the buildPhase.


meta = with stdenv.lib; {
description = "A no bullshit screen capture tool";
homepage = "https://github.com/buhman/capture";
maintainers = [ maintainers.ar1a ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a license https://search.nix.gsc.io/?q=license%20%3D&i=nope&files=&repos= (same with the other package.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neither packages have licenses, and as far as i could tell the default license is unfree - which would be accurate here i think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I'm not sure we can really package software which isn't licensed... Maybe you're right, though. Can you open issues on those repos and ask them to apply a license?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ptpb/pb_cli#12 buhman/capture#6

I thought we could package unfree software, for example discord or spotify

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure we can, but they have a license saying they're unfree... but unlicensed is much less clear about rights, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not sure, i would argue that they just forgot to license the code especially because its advertised https://ptpb.pw/#shell-functions here but obviously that wouldn't really hold up. is there anyone you can ping who knows more about this stuff?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the GitHub TOS changed to grant some basic licenses, but it turns out to be much more minimal than I expected:

If you publish your source code in a public repository on GitHub, according to the Terms of Service, other GitHub users have the right to view and fork your repository within the GitHub site.

I don't know ... I think there isn't a strict policy around requiring a license for Nixpkgs inclusion, but it sure seems there should be one ;)

I won't block on this problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should i explicitly set it to unfree for the meantime then or just leave it omitted

};
}
10 changes: 10 additions & 0 deletions pkgs/tools/misc/pb_cli/0001-eval-fix.patch
Original file line number Diff line number Diff line change
@@ -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 "$@"
40 changes: 40 additions & 0 deletions pkgs/tools/misc/pb_cli/default.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};
}
4 changes: 4 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18711,6 +18711,10 @@ in

packet = callPackage ../development/tools/packet { };

pb_cli = callPackage ../tools/misc/pb_cli {};

capture = callPackage ../tools/misc/capture {};

pbrt = callPackage ../applications/graphics/pbrt { };

pcsxr = callPackage ../misc/emulators/pcsxr {
Expand Down