3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/services/web-apps/ethercalc.nix
pennae 2e751c0772 treewide: automatically md-convert option descriptions
the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
2022-07-30 15:16:34 +02:00

63 lines
1.8 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.ethercalc;
in {
options = {
services.ethercalc = {
enable = mkOption {
default = false;
type = types.bool;
description = lib.mdDoc ''
ethercalc, an online collaborative spreadsheet server.
Persistent state will be maintained under
{file}`/var/lib/ethercalc`. Upstream supports using a
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;
description = lib.mdDoc "Ethercalc package to use.";
};
host = mkOption {
type = types.str;
default = "0.0.0.0";
description = lib.mdDoc "Address to listen on (use 0.0.0.0 to allow access from any address).";
};
port = mkOption {
type = types.port;
default = 8000;
description = lib.mdDoc "Port to bind to.";
};
};
};
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";
};
};
};
}