Two nixpkgs derivations try binding same system port(s)

Hi Nix-ers, I’ve encounter an issue I do not know if it’s just technical debt on my side or effectively a bug:

  • I’m using TT-RSS

  • I’ve added, to try it, Grocy

Both are locally served web-apps (PHP + webserver, plus postgres for TT-RSS, and SQLite for Grocy). If both are enabled both do not works. Maybe relevant configs excerpts:

tt-rss = {
  enable = true;

  database = {
    type = "pgsql";
    #...
  }; # database

  email = {
    #...
  }; # email

  virtualHost = "news.local";
  selfUrlPath = "http://192.168.100.1"; # local wireguard, if relevant
}; # tt-rss

postgresql = {
  #...
}; # postgresql

nginx = {
  enable = true;
  recommendedGzipSettings = true;
  recommendedOptimisation = true;
  recommendedProxySettings = true;
  recommendedTlsSettings = true;
}; # nginx

and

grocy = {
  enable = true;
  hostName = "grocy.local";
  nginx.enableSSL = false;
  dataDir = "/var/lib/grocy";

  settings = {
  #...
  }; # settings
}; # grocy

I suppose both try to spawn an nginx instance to listen on port 80 but both do not have an option to specify a custom port/a virtual host.

How can I proceed in general, I mean when some derivation of some web-apps run a webserver and have no way to specify it’s basic (or less basic) config on the same host/no virtualhost configs etc?

I fail to find useful docs on that subject unfortunately…

Thanks :slight_smile:

Just faced the exact same problem with exact same package: TT-RSS

Don’t they? For grocy, you specify hostName, which is then used as the virtual host, and for tt-rss, the option is virtualHost, and the Nginx is not set up at all if it is not specified.

In theory, this should work, as they enable the same nginx server (no conflict here) and configure distinct virtual hosts. You may need to provide more information on how it “does not work”.

Edit: sorry for necroing, I noticed OP started this thread more than a year ago. But I assume it is still relevant for @lostmsu ?

1 Like

I actually just saw another thread which got my issue resolved. All I needed is to configure my virtual host listen in the nginx section:

  services.nginx = {
    enable = true;

    virtualHosts."my.virtual.host" = {
        listen = [ { port = 4124; addr="127.0.0.1"; } ];
    };
  };