1 { config, lib, pkgs, ...}:
4 cfg = config.services.gateone;
9 enable = mkEnableOption (lib.mdDoc "GateOne server");
11 default = "/run/gateone";
13 description = lib.mdDoc "Path of pid files for GateOne.";
15 settingsDir = mkOption {
16 default = "/var/lib/gateone";
18 description = lib.mdDoc "Path of configuration files for GateOne.";
22 config = mkIf cfg.enable {
23 environment.systemPackages = with pkgs.pythonPackages; [
24 gateone pkgs.openssh pkgs.procps pkgs.coreutils pkgs.cacert];
26 users.users.gateone = {
27 description = "GateOne privilege separation user";
28 uid = config.ids.uids.gateone;
29 home = cfg.settingsDir;
31 users.groups.gateone.gid = config.ids.gids.gateone;
33 systemd.services.gateone = with pkgs; {
34 description = "GateOne web-based terminal";
35 path = [ pythonPackages.gateone nix openssh procps coreutils ];
37 if [ ! -d ${cfg.settingsDir} ] ; then
38 mkdir -m 0750 -p ${cfg.settingsDir}
39 chown -R gateone:gateone ${cfg.settingsDir}
41 if [ ! -d ${cfg.pidDir} ] ; then
42 mkdir -m 0750 -p ${cfg.pidDir}
43 chown -R gateone:gateone ${cfg.pidDir}
46 #unitConfig.RequiresMountsFor = "${cfg.settingsDir}";
48 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}'';
51 WorkingDirectory = cfg.settingsDir;
54 wantedBy = [ "multi-user.target" ];
55 requires = [ "network.target" ];