fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Robert HelgessonMerge PR #421575790441

master
886 B41 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7  cfg = config.programs.gallery-dl;
8
9  jsonFormat = pkgs.formats.json { };
10
11in {
12  meta.maintainers = [ ];
13
14  options.programs.gallery-dl = {
15    enable = mkEnableOption "gallery-dl";
16
17    settings = mkOption {
18      type = jsonFormat.type;
19      default = { };
20      example = literalExpression ''
21        {
22          extractor.base-directory = "~/Downloads";
23        }
24      '';
25      description = ''
26        Configuration written to
27        {file}`$XDG_CONFIG_HOME/gallery-dl/config.json`. See
28        <https://github.com/mikf/gallery-dl#configuration>
29        for supported values.
30      '';
31    };
32  };
33
34  config = mkIf cfg.enable {
35    home.packages = [ pkgs.gallery-dl ];
36
37    xdg.configFile."gallery-dl/config.json" = mkIf (cfg.settings != { }) {
38      source = jsonFormat.generate "gallery-dl-settings" cfg.settings;
39    };
40  };
41}