update flake
This commit is contained in:
parent
2955c2cfe1
commit
3011036748
3 changed files with 86 additions and 35 deletions
22
README.org
22
README.org
|
|
@ -26,12 +26,26 @@ If you have a recent *Nix* version and *flakes* are enabled, you can execute the
|
|||
#+end_example
|
||||
|
||||
If you are not running the [[https://nixos.org/][Nix]] package manager, you should definitely try it out.
|
||||
|
||||
Anyway, this is just a shell script so clone the repo, make sure the dependencies listed below are fulfilled and there you go.
|
||||
|
||||
#+begin_example sh
|
||||
./tyt --help
|
||||
#+end_example
|
||||
|
||||
** Dependencies
|
||||
|
||||
If you are running tyt as *Nix flake* you don't have to care about dependencies.
|
||||
A mpv version with scripts is used by default, this enables *MPRIS support* while playback and *skipping sponsored seqments* of videos.
|
||||
|
||||
These are the dependencies of the script:
|
||||
|
||||
- [[https://stedolan.github.io/jq/][jq]]
|
||||
- [[https://mpv.io/][mpv]]
|
||||
- [[https://ytdl-org.github.io/youtube-dl/][youtube-dl]]
|
||||
|
||||
If you are not running Nix, make sure those are available on your system and hope that everything works.
|
||||
|
||||
** Usage
|
||||
|
||||
#+begin_example text
|
||||
|
|
@ -60,14 +74,6 @@ Anyway, this is just a shell script so clone the repo, make sure the dependencie
|
|||
** Script
|
||||
*** Dependencies
|
||||
|
||||
The dependencies of the script are:
|
||||
|
||||
- [[https://stedolan.github.io/jq/][jq]]
|
||||
- [[https://mpv.io/][mpv]]
|
||||
- [[https://ytdl-org.github.io/youtube-dl/][youtube-dl]]
|
||||
|
||||
Please make sure those are available on your system.
|
||||
|
||||
On the start of the script, it is checked if the dependencies are fulfilled.
|
||||
|
||||
#+begin_src bash
|
||||
|
|
|
|||
22
flake.lock
generated
22
flake.lock
generated
|
|
@ -1,12 +1,27 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1618217525,
|
||||
"narHash": "sha256-WGrhVczjXTiswQaoxQ+0PTfbLNeOQM6M36zvLn78AYg=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c6169a2772643c4a93a0b5ac1c61e296cba68544",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1618467905,
|
||||
"narHash": "sha256-T5J91HMTXLcRK7PgN/a7gU9Mv0skkrdyF2q4PSyqUzk=",
|
||||
"lastModified": 1618640098,
|
||||
"narHash": "sha256-RPdJQX2/VcLMb04TNZtyCgHyTOjwcaM3UjBziNwGz1g=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "7bf3b1fe952dcc59a8d3e9c5f6c99d6401ee49c7",
|
||||
"rev": "a03f318104db1a74791746595829de4c2d53e658",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -16,6 +31,7 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
75
flake.nix
75
flake.nix
|
|
@ -1,35 +1,64 @@
|
|||
{
|
||||
description = "Play YouTube videos from the command line in a convenient way";
|
||||
|
||||
outputs = { self, nixpkgs }: {
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
packages.x86_64-linux.tyt =
|
||||
with import nixpkgs { system = "x86_64-linux"; };
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
|
||||
name = "tyt";
|
||||
src = self;
|
||||
# Use mpv with scripts
|
||||
mpv = (pkgs.mpv-with-scripts.override {
|
||||
scripts = [
|
||||
pkgs.mpvScripts.mpris
|
||||
pkgs.mpvScripts.sponsorblock
|
||||
];
|
||||
});
|
||||
|
||||
buildInputs = [
|
||||
jq
|
||||
mpv
|
||||
youtube-dl
|
||||
];
|
||||
dependencies = with pkgs; [
|
||||
jq
|
||||
mpv
|
||||
youtube-dl
|
||||
];
|
||||
|
||||
patchPhase = ''
|
||||
substituteInPlace tyt \
|
||||
--replace jq ${jq}/bin/jq \
|
||||
--replace mpv ${mpv}/bin/mpv \
|
||||
--replace youtube-dl ${youtube-dl}/bin/youtube-dl
|
||||
'';
|
||||
in
|
||||
{
|
||||
|
||||
installPhase = ''
|
||||
install -m 755 -D tyt $out/bin/tyt
|
||||
'';
|
||||
};
|
||||
# Package
|
||||
|
||||
defaultPackage.x86_64-linux = self.packages.x86_64-linux.tyt;
|
||||
packages.tyt =
|
||||
|
||||
};
|
||||
pkgs.stdenv.mkDerivation {
|
||||
|
||||
name = "tyt";
|
||||
src = self;
|
||||
|
||||
buildInputs = dependencies;
|
||||
|
||||
patchPhase = with pkgs; ''
|
||||
substituteInPlace tyt \
|
||||
--replace jq ${jq}/bin/jq \
|
||||
--replace mpv ${mpv}/bin/mpv \
|
||||
--replace youtube-dl ${youtube-dl}/bin/youtube-dl
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
install -m 755 -D tyt $out/bin/tyt
|
||||
'';
|
||||
};
|
||||
|
||||
defaultPackage = self.packages.${system}.tyt;
|
||||
|
||||
# Development shell
|
||||
|
||||
devShell = pkgs.mkShell {
|
||||
buildInputs = dependencies;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue