1 { config, pkgs, lib, ... }:
3 cfg = config.services.torque.server;
9 services.torque.server = {
11 enable = lib.mkEnableOption "torque server";
17 config = lib.mkIf cfg.enable {
18 environment.systemPackages = [ pkgs.torque ];
20 systemd.services.torque-server-init = {
21 path = with pkgs; [ torque util-linux procps inetutils ];
24 tmpsetup=$(mktemp -t torque-XXXX)
25 cp -p ${torque}/bin/torque.setup $tmpsetup
26 sed -i $tmpsetup -e 's/pbs_server -t create/pbs_server -f -t create/'
30 hostname > /var/spool/torque/server_name
31 cp -prv ${torque}/var/spool/torque/* /var/spool/torque/
36 kill $(pgrep pbs_server) 2>/dev/null
37 kill $(pgrep trqauthd) 2>/dev/null
42 RemainAfterExit = true;
46 ConditionPathExists = "!/var/spool/torque";
50 systemd.services.trqauthd = {
53 requires = [ "torque-server-init.service" ];
54 after = [ "torque-server-init.service" ];
58 ExecStart = "${torque}/bin/trqauthd";
62 systemd.services.torque-server = {
65 wantedBy = [ "multi-user.target" ];
66 wants = [ "torque-scheduler.service" "trqauthd.service" ];
67 before = [ "trqauthd.service" ];
68 requires = [ "torque-server-init.service" ];
69 after = [ "torque-server-init.service" "network.target" ];
73 ExecStart = "${torque}/bin/pbs_server";
74 ExecStop = "${torque}/bin/qterm";
75 PIDFile = "/var/spool/torque/server_priv/server.lock";
79 systemd.services.torque-scheduler = {
82 requires = [ "torque-server-init.service" ];
83 after = [ "torque-server-init.service" ];
87 ExecStart = "${torque}/bin/pbs_sched";
88 PIDFile = "/var/spool/torque/sched_priv/sched.lock";