at 24.11-pre 1.6 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 cfg = config.services.ethercalc; 7in { 8 options = { 9 services.ethercalc = { 10 enable = mkOption { 11 default = false; 12 type = types.bool; 13 description = '' 14 ethercalc, an online collaborative spreadsheet server. 15 16 Persistent state will be maintained under 17 {file}`/var/lib/ethercalc`. Upstream supports using a 18 redis server for storage and recommends the redis backend for 19 intensive use; however, the Nix module doesn't currently support 20 redis. 21 22 Note that while ethercalc is a good and robust project with an active 23 issue tracker, there haven't been new commits since the end of 2020. 24 ''; 25 }; 26 27 package = mkPackageOption pkgs "ethercalc" { }; 28 29 host = mkOption { 30 type = types.str; 31 default = "0.0.0.0"; 32 description = "Address to listen on (use 0.0.0.0 to allow access from any address)."; 33 }; 34 35 port = mkOption { 36 type = types.port; 37 default = 8000; 38 description = "Port to bind to."; 39 }; 40 }; 41 }; 42 43 config = mkIf cfg.enable { 44 systemd.services.ethercalc = { 45 description = "Ethercalc service"; 46 wantedBy = [ "multi-user.target" ]; 47 after = [ "network.target" ]; 48 serviceConfig = { 49 DynamicUser = true; 50 ExecStart = "${cfg.package}/bin/ethercalc --host ${cfg.host} --port ${toString cfg.port}"; 51 Restart = "always"; 52 StateDirectory = "ethercalc"; 53 WorkingDirectory = "/var/lib/ethercalc"; 54 }; 55 }; 56 }; 57}