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:
parent
4cfc0a1e02
commit
f9f4c8e1e7
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -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
|
||||
|
||||
|
|
|
@ -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'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
41
modules/programs/gallery-dl.nix
Normal file
41
modules/programs/gallery-dl.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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
|
||||
|
|
1
tests/modules/programs/gallery-dl/default.nix
Normal file
1
tests/modules/programs/gallery-dl/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ gallery-dl = ./gallery-dl.nix; }
|
28
tests/modules/programs/gallery-dl/gallery-dl.nix
Normal file
28
tests/modules/programs/gallery-dl/gallery-dl.nix
Normal 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/"
|
||||
}
|
||||
}
|
||||
''}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue