edolstra / nix-serve

A standalone Nix binary cache server
GNU Lesser General Public License v2.1
174 stars 37 forks source link

CGI version #1

Closed 7c6f434c closed 10 years ago

7c6f434c commented 10 years ago

Can this be run as CGI? Would a very dumb CGI wrapper that launches the server at a random port unless it is already running get accepted? I have Apache anyway, and I want a drop-and-forget CGI, or a NixOS service…

edolstra commented 10 years ago

Yes, this can be done by invoking plackup -s CGI nix-serve.psgi. Example:

$ REQUEST_METHOD=GET SCRIPT_NAME=nix-serve SERVER_NAME=foo SERVER_PORT=12345 REQUEST_URI=/nix-cache-info PATH_INFO=/nix-cache-info plackup -s CGI ./nix-serve.psgi  2> /dev/null
Status: 200 OK
Content-Type: text/plain

StoreDir: /nix/store
WantMassQuery: 1
Priority: 30