uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
93
nixos/modules/services/web-servers/lighttpd/cgit.nix
Normal file
93
nixos/modules/services/web-servers/lighttpd/cgit.nix
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.lighttpd.cgit;
|
||||
pathPrefix = if stringLength cfg.subdir == 0 then "" else "/" + cfg.subdir;
|
||||
configFile = pkgs.writeText "cgitrc"
|
||||
''
|
||||
# default paths to static assets
|
||||
css=${pathPrefix}/cgit.css
|
||||
logo=${pathPrefix}/cgit.png
|
||||
favicon=${pathPrefix}/favicon.ico
|
||||
|
||||
# user configuration
|
||||
${cfg.configText}
|
||||
'';
|
||||
in
|
||||
{
|
||||
|
||||
options.services.lighttpd.cgit = {
|
||||
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
If true, enable cgit (fast web interface for git repositories) as a
|
||||
sub-service in lighttpd.
|
||||
'';
|
||||
};
|
||||
|
||||
subdir = mkOption {
|
||||
default = "cgit";
|
||||
example = "";
|
||||
type = types.str;
|
||||
description = ''
|
||||
The subdirectory in which to serve cgit. The web application will be
|
||||
accessible at http://yourserver/''${subdir}
|
||||
'';
|
||||
};
|
||||
|
||||
configText = mkOption {
|
||||
default = "";
|
||||
example = literalExpression ''
|
||||
'''
|
||||
source-filter=''${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py
|
||||
about-filter=''${pkgs.cgit}/lib/cgit/filters/about-formatting.sh
|
||||
cache-size=1000
|
||||
scan-path=/srv/git
|
||||
'''
|
||||
'';
|
||||
type = types.lines;
|
||||
description = ''
|
||||
Verbatim contents of the cgit runtime configuration file. Documentation
|
||||
(with cgitrc example file) is available in "man cgitrc". Or online:
|
||||
http://git.zx2c4.com/cgit/tree/cgitrc.5.txt
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
# make the cgitrc manpage available
|
||||
environment.systemPackages = [ pkgs.cgit ];
|
||||
|
||||
# declare module dependencies
|
||||
services.lighttpd.enableModules = [ "mod_cgi" "mod_alias" "mod_setenv" ];
|
||||
|
||||
services.lighttpd.extraConfig = ''
|
||||
$HTTP["url"] =~ "^/${cfg.subdir}" {
|
||||
cgi.assign = (
|
||||
"cgit.cgi" => "${pkgs.cgit}/cgit/cgit.cgi"
|
||||
)
|
||||
alias.url = (
|
||||
"${pathPrefix}/cgit.css" => "${pkgs.cgit}/cgit/cgit.css",
|
||||
"${pathPrefix}/cgit.png" => "${pkgs.cgit}/cgit/cgit.png",
|
||||
"${pathPrefix}" => "${pkgs.cgit}/cgit/cgit.cgi"
|
||||
)
|
||||
setenv.add-environment = (
|
||||
"CGIT_CONFIG" => "${configFile}"
|
||||
)
|
||||
}
|
||||
'';
|
||||
|
||||
systemd.services.lighttpd.preStart = ''
|
||||
mkdir -p /var/cache/cgit
|
||||
chown lighttpd:lighttpd /var/cache/cgit
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
62
nixos/modules/services/web-servers/lighttpd/collectd.nix
Normal file
62
nixos/modules/services/web-servers/lighttpd/collectd.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{ config, lib, options, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.lighttpd.collectd;
|
||||
opt = options.services.lighttpd.collectd;
|
||||
|
||||
collectionConf = pkgs.writeText "collection.conf" ''
|
||||
datadir: "${config.services.collectd.dataDir}"
|
||||
libdir: "${config.services.collectd.package}/lib/collectd"
|
||||
'';
|
||||
|
||||
defaultCollectionCgi = config.services.collectd.package.overrideDerivation(old: {
|
||||
name = "collection.cgi";
|
||||
dontConfigure = true;
|
||||
buildPhase = "true";
|
||||
installPhase = ''
|
||||
substituteInPlace contrib/collection.cgi --replace '"/etc/collection.conf"' '$ENV{COLLECTION_CONF}'
|
||||
cp contrib/collection.cgi $out
|
||||
'';
|
||||
});
|
||||
in
|
||||
{
|
||||
|
||||
options.services.lighttpd.collectd = {
|
||||
|
||||
enable = mkEnableOption "collectd subservice accessible at http://yourserver/collectd";
|
||||
|
||||
collectionCgi = mkOption {
|
||||
type = types.path;
|
||||
default = defaultCollectionCgi;
|
||||
defaultText = literalDocBook ''
|
||||
<literal>config.${options.services.collectd.package}</literal> configured for lighttpd
|
||||
'';
|
||||
description = ''
|
||||
Path to collection.cgi script from (collectd sources)/contrib/collection.cgi
|
||||
This option allows to use a customized version
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.lighttpd.enableModules = [ "mod_cgi" "mod_alias" "mod_setenv" ];
|
||||
|
||||
services.lighttpd.extraConfig = ''
|
||||
$HTTP["url"] =~ "^/collectd" {
|
||||
cgi.assign = (
|
||||
".cgi" => "${pkgs.perl}/bin/perl"
|
||||
)
|
||||
alias.url = (
|
||||
"/collectd" => "${cfg.collectionCgi}"
|
||||
)
|
||||
setenv.add-environment = (
|
||||
"PERL5LIB" => "${with pkgs.perlPackages; makePerlPath [ CGI HTMLParser URI pkgs.rrdtool ]}",
|
||||
"COLLECTION_CONF" => "${collectionConf}"
|
||||
)
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
||||
268
nixos/modules/services/web-servers/lighttpd/default.nix
Normal file
268
nixos/modules/services/web-servers/lighttpd/default.nix
Normal file
|
|
@ -0,0 +1,268 @@
|
|||
# NixOS module for lighttpd web server
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.services.lighttpd;
|
||||
|
||||
# List of known lighttpd modules, ordered by how the lighttpd documentation
|
||||
# recommends them being imported:
|
||||
# http://redmine.lighttpd.net/projects/1/wiki/Server_modulesDetails
|
||||
#
|
||||
# Some modules are always imported and should not appear in the config:
|
||||
# disallowedModules = [ "mod_indexfile" "mod_dirlisting" "mod_staticfile" ];
|
||||
#
|
||||
# For full module list, see the output of running ./configure in the lighttpd
|
||||
# source.
|
||||
allKnownModules = [
|
||||
"mod_rewrite"
|
||||
"mod_redirect"
|
||||
"mod_alias"
|
||||
"mod_access"
|
||||
"mod_auth"
|
||||
"mod_status"
|
||||
"mod_simple_vhost"
|
||||
"mod_evhost"
|
||||
"mod_userdir"
|
||||
"mod_secdownload"
|
||||
"mod_fastcgi"
|
||||
"mod_proxy"
|
||||
"mod_cgi"
|
||||
"mod_ssi"
|
||||
"mod_compress"
|
||||
"mod_usertrack"
|
||||
"mod_expire"
|
||||
"mod_rrdtool"
|
||||
"mod_accesslog"
|
||||
# Remaining list of modules, order assumed to be unimportant.
|
||||
"mod_authn_dbi"
|
||||
"mod_authn_file"
|
||||
"mod_authn_gssapi"
|
||||
"mod_authn_ldap"
|
||||
"mod_authn_mysql"
|
||||
"mod_authn_pam"
|
||||
"mod_authn_sasl"
|
||||
"mod_cml"
|
||||
"mod_deflate"
|
||||
"mod_evasive"
|
||||
"mod_extforward"
|
||||
"mod_flv_streaming"
|
||||
"mod_geoip"
|
||||
"mod_magnet"
|
||||
"mod_mysql_vhost"
|
||||
"mod_openssl" # since v1.4.46
|
||||
"mod_scgi"
|
||||
"mod_setenv"
|
||||
"mod_trigger_b4_dl"
|
||||
"mod_uploadprogress"
|
||||
"mod_vhostdb" # since v1.4.46
|
||||
"mod_webdav"
|
||||
"mod_wstunnel" # since v1.4.46
|
||||
];
|
||||
|
||||
maybeModuleString = moduleName:
|
||||
if elem moduleName cfg.enableModules then ''"${moduleName}"'' else "";
|
||||
|
||||
modulesIncludeString = concatStringsSep ",\n"
|
||||
(filter (x: x != "") (map maybeModuleString allKnownModules));
|
||||
|
||||
configFile = if cfg.configText != "" then
|
||||
pkgs.writeText "lighttpd.conf" ''
|
||||
${cfg.configText}
|
||||
''
|
||||
else
|
||||
pkgs.writeText "lighttpd.conf" ''
|
||||
server.document-root = "${cfg.document-root}"
|
||||
server.port = ${toString cfg.port}
|
||||
server.username = "lighttpd"
|
||||
server.groupname = "lighttpd"
|
||||
|
||||
# As for why all modules are loaded here, instead of having small
|
||||
# server.modules += () entries in each sub-service extraConfig snippet,
|
||||
# read this:
|
||||
#
|
||||
# http://redmine.lighttpd.net/projects/1/wiki/Server_modulesDetails
|
||||
# http://redmine.lighttpd.net/issues/2337
|
||||
#
|
||||
# Basically, lighttpd doesn't want to load (or even silently ignore) a
|
||||
# module for a second time, and there is no way to check if a module has
|
||||
# been loaded already. So if two services were to put the same module in
|
||||
# server.modules += (), that would break the lighttpd configuration.
|
||||
server.modules = (
|
||||
${modulesIncludeString}
|
||||
)
|
||||
|
||||
# Logging (logs end up in systemd journal)
|
||||
accesslog.use-syslog = "enable"
|
||||
server.errorlog-use-syslog = "enable"
|
||||
|
||||
${lib.optionalString cfg.enableUpstreamMimeTypes ''
|
||||
include "${pkgs.lighttpd}/share/lighttpd/doc/config/conf.d/mime.conf"
|
||||
''}
|
||||
|
||||
static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )
|
||||
index-file.names = ( "index.html" )
|
||||
|
||||
${if cfg.mod_userdir then ''
|
||||
userdir.path = "public_html"
|
||||
'' else ""}
|
||||
|
||||
${if cfg.mod_status then ''
|
||||
status.status-url = "/server-status"
|
||||
status.statistics-url = "/server-statistics"
|
||||
status.config-url = "/server-config"
|
||||
'' else ""}
|
||||
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
options = {
|
||||
|
||||
services.lighttpd = {
|
||||
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Enable the lighttpd web server.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
default = pkgs.lighttpd;
|
||||
defaultText = "pkgs.lighttpd";
|
||||
type = types.package;
|
||||
description = ''
|
||||
lighttpd package to use.
|
||||
'';
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
default = 80;
|
||||
type = types.port;
|
||||
description = ''
|
||||
TCP port number for lighttpd to bind to.
|
||||
'';
|
||||
};
|
||||
|
||||
document-root = mkOption {
|
||||
default = "/srv/www";
|
||||
type = types.path;
|
||||
description = ''
|
||||
Document-root of the web server. Must be readable by the "lighttpd" user.
|
||||
'';
|
||||
};
|
||||
|
||||
mod_userdir = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
If true, requests in the form /~user/page.html are rewritten to take
|
||||
the file public_html/page.html from the home directory of the user.
|
||||
'';
|
||||
};
|
||||
|
||||
enableModules = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "mod_cgi" "mod_status" ];
|
||||
description = ''
|
||||
List of lighttpd modules to enable. Sub-services take care of
|
||||
enabling modules as needed, so this option is mainly for when you
|
||||
want to add custom stuff to
|
||||
<option>services.lighttpd.extraConfig</option> that depends on a
|
||||
certain module.
|
||||
'';
|
||||
};
|
||||
|
||||
enableUpstreamMimeTypes = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to include the list of mime types bundled with lighttpd
|
||||
(upstream). If you disable this, no mime types will be added by
|
||||
NixOS and you will have to add your own mime types in
|
||||
<option>services.lighttpd.extraConfig</option>.
|
||||
'';
|
||||
};
|
||||
|
||||
mod_status = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Show server status overview at /server-status, statistics at
|
||||
/server-statistics and list of loaded modules at /server-config.
|
||||
'';
|
||||
};
|
||||
|
||||
configText = mkOption {
|
||||
default = "";
|
||||
type = types.lines;
|
||||
example = "...verbatim config file contents...";
|
||||
description = ''
|
||||
Overridable config file contents to use for lighttpd. By default, use
|
||||
the contents automatically generated by NixOS.
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
default = "";
|
||||
type = types.lines;
|
||||
description = ''
|
||||
These configuration lines will be appended to the generated lighttpd
|
||||
config file. Note that this mechanism does not work when the manual
|
||||
<option>configText</option> option is used.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
assertions = [
|
||||
{ assertion = all (x: elem x allKnownModules) cfg.enableModules;
|
||||
message = ''
|
||||
One (or more) modules in services.lighttpd.enableModules are
|
||||
unrecognized.
|
||||
|
||||
Known modules: ${toString allKnownModules}
|
||||
|
||||
services.lighttpd.enableModules: ${toString cfg.enableModules}
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
services.lighttpd.enableModules = mkMerge
|
||||
[ (mkIf cfg.mod_status [ "mod_status" ])
|
||||
(mkIf cfg.mod_userdir [ "mod_userdir" ])
|
||||
# always load mod_accesslog so that we can log to the journal
|
||||
[ "mod_accesslog" ]
|
||||
];
|
||||
|
||||
systemd.services.lighttpd = {
|
||||
description = "Lighttpd Web Server";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig.ExecStart = "${cfg.package}/sbin/lighttpd -D -f ${configFile}";
|
||||
# SIGINT => graceful shutdown
|
||||
serviceConfig.KillSignal = "SIGINT";
|
||||
};
|
||||
|
||||
users.users.lighttpd = {
|
||||
group = "lighttpd";
|
||||
description = "lighttpd web server privilege separation user";
|
||||
uid = config.ids.uids.lighttpd;
|
||||
};
|
||||
|
||||
users.groups.lighttpd.gid = config.ids.gids.lighttpd;
|
||||
};
|
||||
}
|
||||
52
nixos/modules/services/web-servers/lighttpd/gitweb.nix
Normal file
52
nixos/modules/services/web-servers/lighttpd/gitweb.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.gitweb;
|
||||
package = pkgs.gitweb.override (optionalAttrs cfg.gitwebTheme {
|
||||
gitwebTheme = true;
|
||||
});
|
||||
|
||||
in
|
||||
{
|
||||
|
||||
options.services.lighttpd.gitweb = {
|
||||
|
||||
enable = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
If true, enable gitweb in lighttpd. Access it at http://yourserver/gitweb
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
config = mkIf config.services.lighttpd.gitweb.enable {
|
||||
|
||||
# declare module dependencies
|
||||
services.lighttpd.enableModules = [ "mod_cgi" "mod_redirect" "mod_alias" "mod_setenv" ];
|
||||
|
||||
services.lighttpd.extraConfig = ''
|
||||
$HTTP["url"] =~ "^/gitweb" {
|
||||
cgi.assign = (
|
||||
".cgi" => "${pkgs.perl}/bin/perl"
|
||||
)
|
||||
url.redirect = (
|
||||
"^/gitweb$" => "/gitweb/"
|
||||
)
|
||||
alias.url = (
|
||||
"/gitweb/static/" => "${package}/static/",
|
||||
"/gitweb/" => "${package}/gitweb.cgi"
|
||||
)
|
||||
setenv.add-environment = (
|
||||
"GITWEB_CONFIG" => "${cfg.gitwebConfigFile}",
|
||||
"HOME" => "${cfg.projectroot}"
|
||||
)
|
||||
}
|
||||
'';
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue