8 cfg = config.services.gateone;
13 enable = lib.mkEnableOption "GateOne server";
14 pidDir = lib.mkOption {
15 default = "/run/gateone";
16 type = lib.types.path;
17 description = "Path of pid files for GateOne.";
19 settingsDir = lib.mkOption {
20 default = "/var/lib/gateone";
21 type = lib.types.path;
22 description = "Path of configuration files for GateOne.";
26 config = lib.mkIf cfg.enable {
27 environment.systemPackages = with pkgs.pythonPackages; [
35 users.users.gateone = {
36 description = "GateOne privilege separation user";
37 uid = config.ids.uids.gateone;
38 home = cfg.settingsDir;
40 users.groups.gateone.gid = config.ids.gids.gateone;
42 systemd.services.gateone = with pkgs; {
43 description = "GateOne web-based terminal";
45 pythonPackages.gateone
52 if [ ! -d ${cfg.settingsDir} ] ; then
53 mkdir -m 0750 -p ${cfg.settingsDir}
54 chown -R gateone:gateone ${cfg.settingsDir}
56 if [ ! -d ${cfg.pidDir} ] ; then
57 mkdir -m 0750 -p ${cfg.pidDir}
58 chown -R gateone:gateone ${cfg.pidDir}
61 #unitConfig.RequiresMountsFor = "${cfg.settingsDir}";
63 ExecStart = ''${pythonPackages.gateone}/bin/gateone --settings_dir=${cfg.settingsDir} --pid_file=${cfg.pidDir}/gateone.pid --gid=${toString config.ids.gids.gateone} --uid=${toString config.ids.uids.gateone}'';
66 WorkingDirectory = cfg.settingsDir;
69 wantedBy = [ "multi-user.target" ];
70 requires = [ "network.target" ];