Add yt-dlp

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-08-09 13:18:59 +03:00
parent 22e0150a65
commit 97a7256967
9 changed files with 72 additions and 20 deletions

View File

@@ -0,0 +1,4 @@
{ ... }:
{
imports = [ ./options.nix ];
}

View File

@@ -0,0 +1,17 @@
{ lib, ... }:
{
options.hardware.cpu =
with lib;
with types;
{
cores = mkOption {
type = ints.positive;
description = "The number of cpu cores.";
};
threads = mkOption {
type = ints.positive;
description = "The number of cpu threads.";
};
};
}

View File

@@ -26,6 +26,7 @@
};
};
# uuidgen -r | tr -d -
# https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/administration/systemd-state.section.md
# https://github.com/NixOS/nixpkgs/pull/286140/files
# https://git.eisfunke.com/config/nixos/-/blob/e65e1dc21d06d07b454005762b177ef151f8bfb6/nixos/machine-id.nix

View File

@@ -0,0 +1,12 @@
{ ... }:
{
services.tlp = {
enable = true;
settings = {
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
};
};
}

View File

@@ -0,0 +1,20 @@
{
user ? throw "user argument is required",
home ? throw "home argument is required",
}:
{ config, ... }:
{
home-manager.users.${user}.programs.yt-dlp = {
enable = true;
settings = {
live-from-start = true;
concurrent-fragments = config.hardware.cpu.threads;
lazy-playlist = true;
cookies-from-browser = "firefox";
embed-subs = true;
sub-langs = "all,-live_chat";
embed-thumbnail = true;
fixup = "detect_or_warn";
};
};
}

View File

@@ -91,13 +91,13 @@
};
};
xdg.mimeApps.defaultApplications = {
"text/html" = "firefox.desktop";
"x-scheme-handler/http" = "firefox.desktop";
"x-scheme-handler/https" = "firefox.desktop";
"x-scheme-handler/about" = "firefox.desktop";
"x-scheme-handler/unknown" = "firefox.desktop";
};
xdg.mimeApps.defaultApplications = lib.attrsets.genAttrs [
"text/html"
"x-scheme-handler/http"
"x-scheme-handler/https"
"x-scheme-handler/about"
"x-scheme-handler/unknown"
] (_: "firefox.desktop");
home.sessionVariables.DEFAULT_BROWSER = lib.meta.getExe pkgs.firefox;