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