1 { config, pkgs, lib, ... }:
4 cfg = config.services.torque.mom;
7 momConfig = pkgs.writeText "torque-mom-config" ''
8 $pbsserver ${cfg.serverNode}
16 services.torque.mom = {
17 enable = lib.mkEnableOption "torque computing node";
19 serverNode = lib.mkOption {
21 description = "Hostname running pbs server.";
28 config = lib.mkIf cfg.enable {
29 environment.systemPackages = [ pkgs.torque ];
31 systemd.services.torque-mom-init = {
32 path = with pkgs; [ torque util-linux procps inetutils ];
37 hostname > /var/spool/torque/server_name
38 cp -v ${momConfig} /var/spool/torque/mom_priv/config
41 serviceConfig.Type = "oneshot";
42 unitConfig.ConditionPathExists = "!/var/spool/torque";
45 systemd.services.torque-mom = {
48 wantedBy = [ "multi-user.target" ];
49 requires = [ "torque-mom-init.service" ];
50 after = [ "torque-mom-init.service" "network.target" ];
54 ExecStart = "${torque}/bin/pbs_mom";
55 PIDFile = "/var/spool/torque/mom_priv/mom.lock";