gallery-dl: add module

gallery-dl [1] is a cli to download image galleries from several image
hosting sites.

[1] https://github.com/mikf/gallery-dl
This commit is contained in:
Mario Rodas 2022-07-09 04:20:00 +00:00 committed by Robert Helgesson
parent 4cfc0a1e02
commit f9f4c8e1e7
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
7 changed files with 82 additions and 0 deletions

View file

@ -0,0 +1,41 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.gallery-dl;
jsonFormat = pkgs.formats.json { };
in {
meta.maintainers = [ maintainers.marsam ];
options.programs.gallery-dl = {
enable = mkEnableOption "gallery-dl";
settings = mkOption {
type = jsonFormat.type;
default = { };
example = literalExpression ''
{
extractor.base-directory = "~/Downloads";
}
'';
description = ''
Configuration written to
<filename>$XDG_CONFIG_HOME/gallery-dl/config.json</filename>. See
<link xlink:href="https://github.com/mikf/gallery-dl#configuration"/>
for supported values.
'';
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.gallery-dl ];
xdg.configFile."gallery-dl/config.json" = mkIf (cfg.settings != { }) {
source = jsonFormat.generate "gallery-dl-settings" cfg.settings;
};
};
}