2022-07-09 04:20:00 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.programs.gallery-dl;
|
|
|
|
|
|
|
|
jsonFormat = pkgs.formats.json { };
|
|
|
|
|
|
|
|
in {
|
2023-06-22 08:16:28 +00:00
|
|
|
meta.maintainers = [ ];
|
2022-07-09 04:20:00 +00:00
|
|
|
|
|
|
|
options.programs.gallery-dl = {
|
2023-07-01 23:45:18 +00:00
|
|
|
enable = mkEnableOption "gallery-dl";
|
2022-07-09 04:20:00 +00:00
|
|
|
|
2024-03-06 17:43:55 +00:00
|
|
|
package = mkPackageOption pkgs "gallery-dl" { };
|
|
|
|
|
2022-07-09 04:20:00 +00:00
|
|
|
settings = mkOption {
|
|
|
|
type = jsonFormat.type;
|
|
|
|
default = { };
|
|
|
|
example = literalExpression ''
|
|
|
|
{
|
|
|
|
extractor.base-directory = "~/Downloads";
|
|
|
|
}
|
|
|
|
'';
|
2023-07-01 23:45:18 +00:00
|
|
|
description = ''
|
2022-07-09 04:20:00 +00:00
|
|
|
Configuration written to
|
2023-06-30 23:30:13 +00:00
|
|
|
{file}`$XDG_CONFIG_HOME/gallery-dl/config.json`. See
|
|
|
|
<https://github.com/mikf/gallery-dl#configuration>
|
2022-07-09 04:20:00 +00:00
|
|
|
for supported values.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2024-03-06 17:43:55 +00:00
|
|
|
home.packages = [ cfg.package ];
|
2022-07-09 04:20:00 +00:00
|
|
|
|
|
|
|
xdg.configFile."gallery-dl/config.json" = mkIf (cfg.settings != { }) {
|
|
|
|
source = jsonFormat.generate "gallery-dl-settings" cfg.settings;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|