1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00

animdl: add module

This commit is contained in:
Aguirre Matteo 2025-09-20 09:31:56 -03:00 committed by Austin Horstman
parent 7a615e2a56
commit 20d75ecd36
4 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,54 @@
{
lib,
pkgs,
config,
...
}:
let
inherit (lib)
mkIf
mkEnableOption
mkPackageOption
mkOption
;
cfg = config.programs.animdl;
yamlFormat = pkgs.formats.yaml { };
in
{
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
options.programs.animdl = {
enable = mkEnableOption "animdl";
package = mkPackageOption pkgs "animdl" { nullable = true; };
settings = mkOption {
inherit (yamlFormat) type;
default = { };
example = {
default_provider = "animixplay";
site_urls.animixplay = "https://www.animixplay.to/";
quality_string = "best[subtitle]/best";
default_player = "mpv";
ffmpeg = {
executable = "ffmpeg";
hls_download = false;
submerge = true;
};
};
description = ''
Configuration settings for animdl. All the available options can be found here:
<https://github.com/justfoolingaround/animdl?tab=readme-ov-file#configurations>.
'';
};
};
config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "programs.animdl" pkgs lib.platforms.linux)
];
home.packages = mkIf (cfg.package != null) [ cfg.package ];
home.file.".config/animdl/config.yml" = mkIf (cfg.settings != { }) {
source = yamlFormat.generate "animdl.yml" cfg.settings;
};
};
}

View file

@ -0,0 +1,9 @@
default_player: mpv
default_provider: animixplay
ffmpeg:
executable: ffmpeg
hls_download: false
submerge: true
quality_string: best[subtitle]/best
site_urls:
animixplay: https://www.animixplay.to/

View file

@ -0,0 +1,5 @@
{ lib, pkgs, ... }:
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
animdl-example-config = ./example-config.nix;
}

View file

@ -0,0 +1,22 @@
{
programs.animdl = {
enable = true;
settings = {
default_provider = "animixplay";
site_urls.animixplay = "https://www.animixplay.to/";
quality_string = "best[subtitle]/best";
default_player = "mpv";
ffmpeg = {
executable = "ffmpeg";
hls_download = false;
submerge = true;
};
};
};
nmt.script = ''
assertFileExists home-files/.config/animdl/config.yml
assertFileContent home-files/.config/animdl/config.yml \
${./config.yml}
'';
}