depot/third_party/home-manager/modules/programs/gallery-dl.nix
Default email 4d19ca4703 Project import generated by Copybara.
GitOrigin-RevId: a7117efb3725e6197dd95424136f79147aa35e5b
2024-06-04 11:23:39 -07:00

43 lines
936 B
Nix

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