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

3
.github/CODEOWNERS vendored
View file

@ -109,6 +109,9 @@ Makefile @thiagokokada
/modules/services/fusuma.nix @iosmanthus
/tests/modules/services/fusuma @iosmanthus
/modules/programs/gallery-dl.nix @marsam
/tests/modules/programs/gallery-dl @marsam
/modules/programs/gh.nix @Gerschtli @berbiche
/tests/modules/programs/gh @Gerschtli @berbiche

View file

@ -689,6 +689,13 @@ in
A new module is available: 'programs.yt-dlp'.
'';
}
{
time = "2022-09-09T09:55:50+00:00";
message = ''
A new module is available: 'programs.gallery-dl'.
'';
}
];
};
}

View file

@ -74,6 +74,7 @@ let
./programs/fish.nix
./programs/foot.nix
./programs/fzf.nix
./programs/gallery-dl.nix
./programs/getmail.nix
./programs/gh.nix
./programs/git.nix

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;
};
};
}

View file

@ -70,6 +70,7 @@ import nmt {
./modules/programs/emacs
./modules/programs/feh
./modules/programs/fish
./modules/programs/gallery-dl
./modules/programs/gh
./modules/programs/git
./modules/programs/gpg

View file

@ -0,0 +1 @@
{ gallery-dl = ./gallery-dl.nix; }

View file

@ -0,0 +1,28 @@
{ ... }:
{
programs.gallery-dl = {
enable = true;
settings = {
cache.file = "~/gallery-dl/cache.sqlite3";
extractor.base-directory = "~/gallery-dl/";
};
};
test.stubs.gallery-dl = { };
nmt.script = ''
assertFileContent home-files/.config/gallery-dl/config.json \
${builtins.toFile "gallery-dl-expected-settings.json" ''
{
"cache": {
"file": "~/gallery-dl/cache.sqlite3"
},
"extractor": {
"base-directory": "~/gallery-dl/"
}
}
''}
'';
}