2022-02-10 20:34:41 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.ethercalc;
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
services.ethercalc = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
2022-02-10 20:34:41 +00:00
|
|
|
ethercalc, an online collaborative spreadsheet server.
|
|
|
|
|
|
|
|
Persistent state will be maintained under
|
2022-08-12 12:06:08 +00:00
|
|
|
{file}`/var/lib/ethercalc`. Upstream supports using a
|
2022-02-10 20:34:41 +00:00
|
|
|
redis server for storage and recommends the redis backend for
|
|
|
|
intensive use; however, the Nix module doesn't currently support
|
|
|
|
redis.
|
|
|
|
|
|
|
|
Note that while ethercalc is a good and robust project with an active
|
|
|
|
issue tracker, there haven't been new commits since the end of 2020.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
default = pkgs.ethercalc;
|
|
|
|
defaultText = literalExpression "pkgs.ethercalc";
|
|
|
|
type = types.package;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Ethercalc package to use.";
|
2022-02-10 20:34:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
host = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "0.0.0.0";
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Address to listen on (use 0.0.0.0 to allow access from any address).";
|
2022-02-10 20:34:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
port = mkOption {
|
|
|
|
type = types.port;
|
|
|
|
default = 8000;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Port to bind to.";
|
2022-02-10 20:34:41 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.services.ethercalc = {
|
|
|
|
description = "Ethercalc service";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
after = [ "network.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
DynamicUser = true;
|
|
|
|
ExecStart = "${cfg.package}/bin/ethercalc --host ${cfg.host} --port ${toString cfg.port}";
|
|
|
|
Restart = "always";
|
|
|
|
StateDirectory = "ethercalc";
|
|
|
|
WorkingDirectory = "/var/lib/ethercalc";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|