mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 04:58:01 +00:00
services/archivebox: replace withDependencies
option with extraPackages
We also added a package option for ArchiveBox alongside it.
This commit is contained in:
parent
edfc8f8cc3
commit
cee845a94b
@ -42,10 +42,6 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
mkJobService = name: value:
|
mkJobService = name: value:
|
||||||
let
|
|
||||||
pkgSet = [ pkgs.archivebox ] ++ (lib.optionals cfg.withDependencies
|
|
||||||
(with pkgs; [ chromium nodejs_latest wget curl youtube-dl ]));
|
|
||||||
in
|
|
||||||
lib.nameValuePair
|
lib.nameValuePair
|
||||||
(jobUnitName name)
|
(jobUnitName name)
|
||||||
{
|
{
|
||||||
@ -53,10 +49,10 @@ let
|
|||||||
"Archivebox archive group '${name}' for ${cfg.archivePath}";
|
"Archivebox archive group '${name}' for ${cfg.archivePath}";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
documentation = [ "https://docs.archivebox.io/" ];
|
documentation = [ "https://docs.archivebox.io/" ];
|
||||||
path = with pkgs; [ ripgrep coreutils ] ++ pkgSet ++ [ config.programs.git.package ];
|
|
||||||
preStart = ''
|
preStart = ''
|
||||||
mkdir -p ${lib.escapeShellArg cfg.archivePath}
|
mkdir -p ${lib.escapeShellArg cfg.archivePath}
|
||||||
'';
|
'';
|
||||||
|
path = [ cfg.package ] ++ cfg.extraPackages;
|
||||||
script = ''
|
script = ''
|
||||||
echo "${lib.concatStringsSep "\n" value.urls}" \
|
echo "${lib.concatStringsSep "\n" value.urls}" \
|
||||||
| archivebox add ${lib.concatStringsSep " " value.extraArgs}
|
| archivebox add ${lib.concatStringsSep " " value.extraArgs}
|
||||||
@ -97,6 +93,8 @@ in
|
|||||||
options.services.archivebox = {
|
options.services.archivebox = {
|
||||||
enable = lib.mkEnableOption "Archivebox service";
|
enable = lib.mkEnableOption "Archivebox service";
|
||||||
|
|
||||||
|
package = lib.mkPackageOption pkgs "archivebox" { };
|
||||||
|
|
||||||
jobs = lib.mkOption {
|
jobs = lib.mkOption {
|
||||||
type = with lib.types; attrsOf (submodule jobType);
|
type = with lib.types; attrsOf (submodule jobType);
|
||||||
description = "A map of archiving tasks for the service.";
|
description = "A map of archiving tasks for the service.";
|
||||||
@ -122,8 +120,27 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
withDependencies =
|
extraPackages = lib.mkOption {
|
||||||
lib.mkEnableOption "additional dependencies to be installed";
|
type = with lib.types; listOf package;
|
||||||
|
description = ''
|
||||||
|
A list of additional packages to be set within the download jobs. By
|
||||||
|
default, it sets the optional dependencies of ArchiveBox for additional
|
||||||
|
download formats and capabilities.
|
||||||
|
'';
|
||||||
|
default = with pkgs; [
|
||||||
|
chromium
|
||||||
|
nodejs_latest
|
||||||
|
wget
|
||||||
|
curl
|
||||||
|
yt-dlp
|
||||||
|
] ++ lib.optional config.programs.git.enable config.programs.git.package;
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
with pkgs; [
|
||||||
|
curl
|
||||||
|
yt-dlp
|
||||||
|
]
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
webserver = {
|
webserver = {
|
||||||
enable = lib.mkEnableOption "ArchiveBox web server";
|
enable = lib.mkEnableOption "ArchiveBox web server";
|
||||||
|
Loading…
Reference in New Issue
Block a user