2022-01-09 05:38:59 +00:00
|
|
|
{ config, options, lib, pkgs, ... }:
|
|
|
|
|
2022-01-11 12:22:08 +00:00
|
|
|
let cfg = config.services.archivebox;
|
2022-01-09 05:38:59 +00:00
|
|
|
in {
|
|
|
|
options.services.archivebox = {
|
|
|
|
enable = lib.mkEnableOption "Archivebox service";
|
|
|
|
|
|
|
|
port = lib.mkOption {
|
|
|
|
type = lib.types.port;
|
|
|
|
description = "The port number to be used for the server at localhost.";
|
|
|
|
default = 8000;
|
|
|
|
example = 8888;
|
|
|
|
};
|
|
|
|
|
|
|
|
archivePath = lib.mkOption {
|
|
|
|
type = with lib.types; either path str;
|
|
|
|
description = "The path of the Archivebox archive.";
|
|
|
|
example = "\${config.xdg.dataHome}/archivebox";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
systemd.user.services.archivebox-server = {
|
|
|
|
Unit = {
|
|
|
|
Description = "Archivebox server for ${cfg.archivePath}";
|
|
|
|
After = "network.target";
|
|
|
|
Documentation = [ "https://docs.archivebox.io/" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
Install.WantedBy = [ "graphical-session.target" ];
|
|
|
|
|
|
|
|
Service = {
|
2022-01-11 12:22:08 +00:00
|
|
|
ExecStart = "${pkgs.archivebox}/bin/archivebox server localhost:${
|
|
|
|
toString cfg.port
|
|
|
|
}";
|
2022-01-09 05:38:59 +00:00
|
|
|
WorkingDirectory = cfg.archivePath;
|
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|