Skip to content

Commit 6b4ddb1

Browse files
committed
add ytdl-sub
1 parent 24b1988 commit 6b4ddb1

4 files changed

Lines changed: 67 additions & 0 deletions

File tree

flake.lock

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
inputs = {
33
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
4+
nixpkgs-ytdl-sub.url = "github:NixOS/nixpkgs/pull/369990/merge"; # https://github.com/NixOS/nixpkgs/pull/369990
45
deploy-sh.url = "github:Defelo/deploy-sh";
56
sops-nix.url = "github:Mic92/sops-nix";
67
nfnix.url = "github:Defelo/nfnix";

hosts/prod/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
./nginx.nix
1111
./restic.nix
1212
./wireguard.nix
13+
./youtube-downloads.nix
1314
];
1415

1516
filesystems.defaultLayout = true;

hosts/prod/youtube-downloads.nix

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
inputs,
3+
pkgs-ytdl-sub,
4+
...
5+
}: let
6+
inherit (inputs) nixpkgs-ytdl-sub;
7+
inherit (pkgs-ytdl-sub) ytdl-sub;
8+
in {
9+
imports = ["${nixpkgs-ytdl-sub}/nixos/modules/services/misc/ytdl-sub.nix"];
10+
11+
services.sshfs.mounts."/mnt/youtube" = {
12+
host = "u381435.your-storagebox.de";
13+
port = 23;
14+
user = "u381435";
15+
path = "youtube";
16+
readOnly = false;
17+
allowOther = true;
18+
};
19+
20+
services.ytdl-sub.package = ytdl-sub;
21+
services.ytdl-sub.instances.default = {
22+
enable = true;
23+
schedule = null; # TODO
24+
25+
config = {
26+
presets."YouTube Playlist" = {
27+
preset = ["Max 480p"]; # TODO
28+
download = "{subscription_value}";
29+
output_options = {
30+
output_directory = "/mnt/youtube";
31+
file_name = "{subscription_name}/{playlist_index_padded}_{%sanitize(title)}.{ext}";
32+
maintain_download_archive = true;
33+
};
34+
ytdl_options = {
35+
cookiefile = "/var/lib/ytdl-sub/default/.cookies";
36+
};
37+
};
38+
};
39+
40+
subscriptions."YouTube Playlist" = {
41+
rust = "https://www.youtube.com/playlist?list=PLNmsVeXQZj7r4HuTyVCDLKlsD9EQzoncP";
42+
quantencomputer = "https://www.youtube.com/playlist?list=PLNmsVeXQZj7qS21FP5tk1QqmeAmd2hpQF";
43+
clean_code = "https://www.youtube.com/playlist?list=PLNmsVeXQZj7ryyZikMDPxxyYxEKtKn0ji";
44+
};
45+
};
46+
47+
systemd.services.ytdl-sub-default.serviceConfig.ReadWritePaths = ["/mnt/youtube"];
48+
}

0 commit comments

Comments
 (0)