Unverified Commit e45abe6d authored by Yt's avatar Yt Committed by GitHub
Browse files

Merge pull request #313634 from onny/stalwart-systemd

stalwart-mail: package und use upstream systemd unit
parents c8b5e00e 336232de
Loading
Loading
Loading
Loading
+56 −57
Original line number Diff line number Diff line
@@ -76,7 +76,9 @@ in {
      };
    };

    systemd.services.stalwart-mail = {
    systemd = {
      packages = [ cfg.package ];
      services.stalwart-mail = {
        wantedBy = [ "multi-user.target" ];
        after = [ "local-fs.target" "network.target" ];

@@ -87,22 +89,14 @@ in {
        '';

        serviceConfig = {
        ExecStart =
          "${cfg.package}/bin/stalwart-mail --config=${configFile}";

        # Base from template resources/systemd/stalwart-mail.service
        Type = "simple";
        LimitNOFILE = 65536;
        KillMode = "process";
        KillSignal = "SIGINT";
        Restart = "on-failure";
        RestartSec = 5;
          ExecStart = [
            ""
            "${cfg.package}/bin/stalwart-mail --config=${configFile}"
          ];

          StandardOutput = "journal";
          StandardError = "journal";
        SyslogIdentifier = "stalwart-mail";

        User = "stalwart-mail";
        Group = "stalwart-mail";
          StateDirectory = "stalwart-mail";

          # Bind standard privileged ports
@@ -134,6 +128,11 @@ in {
          SystemCallFilter = [ "@system-service" "~@privileged" ];
          UMask = "0077";
        };
        unitConfig.ConditionPathExists = [
          ""
          "${configFile}"
        ];
      };
    };

    # Make admin commands available in the shell
+7 −0
Original line number Diff line number Diff line
@@ -62,6 +62,13 @@ rustPlatform.buildRustPackage {
    ROCKSDB_LIB_DIR = "${rocksdb}/lib";
  };

  postInstall = ''
    mkdir -p $out/lib/systemd/system

    substitute resources/systemd/stalwart-mail.service $out/lib/systemd/system/stalwart-mail.service \
      --replace "__PATH__" "$out"
  '';

  # Tests require reading to /etc/resolv.conf
  doCheck = false;