Skip to content

Instantly share code, notes, and snippets.

@aforemny
Created May 22, 2012 22:12
Show Gist options
  • Save aforemny/2771986 to your computer and use it in GitHub Desktop.
Save aforemny/2771986 to your computer and use it in GitHub Desktop.
minimal Nix expression for a lighttpd service
{ config, pkgs, ... }:
with pkgs.lib;
let
lighttpdConf = pkgs.writeText "lighttpd.conf" ''
server.document-root = "/var/www/"
server.port = 3000
'';
in {
options.services.lighttpd = {
enable = mkOption {
default = false;
};
};
config = mkIf config.services.lighttpd.enable {
environment.systemPackages = pkgs.lighttpd;
jobs.lighttpd = {
startOn = "started network-interfaces";
stopOn = "stopping network-interfaces";
daemonType = "fork";
exec = "${lighttpd}/bin/lighttpd -f ${lighttpdConf} -D";
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment