48 lines
893 B
Nix
48 lines
893 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.etherpad;
|
|
ethernet-pkg = import ./etherpad-pkg.nix;
|
|
nodePackages = import ./node-packages.nix;
|
|
in
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
services.etherpad = {
|
|
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Whether to enable etherpad service.
|
|
'';
|
|
};
|
|
};
|
|
|
|
};
|
|
|
|
|
|
###### implementation
|
|
|
|
config = mkIf cfg.enable {
|
|
environment.systemPackages = [nodePackages ethernet-pkg pkgs.nodejs pkgs.curl];
|
|
systemd.services.etherpad = {
|
|
description = "etherpad service";
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
Restart = "always";
|
|
User = "etherpad";
|
|
ExecStart = "${pkgs.nodejs} ${ethernet-pkg}/src/node/server.js";
|
|
};
|
|
wantedBy = [ "multi-user.target" ];
|
|
};
|
|
};
|
|
}
|