nur-packages

My NUR packages
git clone git://git.sikmir.ru/nur-packages
Log | Files | Refs | README | LICENSE

flashmq.nix (758B)


      1 {
      2   config,
      3   lib,
      4   pkgs,
      5   ...
      6 }:
      7 
      8 with lib;
      9 
     10 let
     11   cfg = config.services.flashmq;
     12   description = "FlashMQ MQTT server";
     13 in
     14 {
     15   options.services.flashmq = {
     16     enable = mkEnableOption description;
     17     package = mkPackageOption pkgs "flashmq" { };
     18   };
     19 
     20   config = mkIf cfg.enable {
     21     systemd.services.flashmq = {
     22       inherit description;
     23       after = [ "network.target" ];
     24       wantedBy = [ "multi-user.target" ];
     25       serviceConfig = {
     26         DynamicUser = true;
     27         LogsDirectory = "flashmq";
     28         LimitNOFILE = "infinity";
     29         ExecStart = "${lib.getExe cfg.package} -c ${configFile}";
     30         ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
     31         Restart = "on-failure";
     32         RestartSec = "5s";
     33       };
     34     };
     35   };
     36 }