};
eldiron = { config, pkgs, ... }:
- let mypkgs = import ./packages.nix;
- mylibs = import ../libs.nix;
+ with import ../libs.nix;
+ let
+ mypkgs = pkgs.callPackage ./packages.nix {
+ inherit checkEnv fetchedGitPrivate fetchedGithub;
+ };
in
{
+ nixpkgs.config.packageOverrides = oldpkgs: rec {
+ gitolite = oldpkgs.gitolite.overrideAttrs(old: rec {
+ name = "gitolite-${version}";
+ version = "3.6.10";
+ src = pkgs.fetchFromGitHub {
+ owner = "sitaramc";
+ repo = "gitolite";
+ rev = "v${version}";
+ sha256 = "0p2697mn6rwm03ndlv7q137zczai82n41aplq1g006ii7f12xy8h";
+ };
+ });
+ gitweb = oldpkgs.gitweb.overrideAttrs(old: {
+ installPhase = old.installPhase + ''
+ cp -r ${./packages/gitweb} $out/gitweb-theme;
+ '';
+ });
+ postgresql = postgresql111;
+ postgresql111 = oldpkgs.postgresql100.overrideAttrs(old: rec {
+ passthru = old.passthru // { psqlSchema = "11.0"; };
+ name = "postgresql-11.1";
+ src = pkgs.fetchurl {
+ url = "mirror://postgresql/source/v11.1/${name}.tar.bz2";
+ sha256 = "026v0sicsh7avzi45waf8shcbhivyxmi7qgn9fd1x0vl520mx0ch";
+ };
+ });
+ mariadb = mariadbPAM;
+ mariadbPAM = oldpkgs.mariadb.overrideAttrs(old: rec {
+ cmakeFlags = old.cmakeFlags ++ [ "-DWITH_AUTHENTICATION_PAM=ON" ];
+ buildInputs = old.buildInputs ++ [ pkgs.pam ];
+ });
+ };
+
networking = {
firewall = {
enable = true;
extension=${pkgs.phpPackages.redis}/lib/php/extensions/redis.so
; For nextcloud
extension=${pkgs.phpPackages.apcu}/lib/php/extensions/apcu.so
+ ; For nextcloud
+ zend_extension=${pkgs.php}/lib/php/extensions/opcache.so
'';
extraConfig = ''
log_level = notice
chown redis /run/redis
'';
gitolite =
- assert mylibs.checkEnv "NIXOPS_GITOLITE_LDAP_PASSWORD";
+ assert checkEnv "NIXOPS_GITOLITE_LDAP_PASSWORD";
let
- gitolite_ldap_groups = mylibs.wrap {
+ gitolite_ldap_groups = wrap {
name = "gitolite_ldap_groups.sh";
file = ./packages/gitolite_ldap_groups.sh;
vars = {
environment.etc."ssh/ldap_authorized_keys" = let
ldap_authorized_keys =
- assert mylibs.checkEnv "NIXOPS_SSHD_LDAP_PASSWORD";
- mylibs.wrap {
+ assert checkEnv "NIXOPS_SSHD_LDAP_PASSWORD";
+ wrap {
name = "ldap_authorized_keys";
file = ./ldap_authorized_keys.sh;
vars = {
};
services.httpd = let
- withSSL = domain: {
+ withConf = domain: {
enableSSL = true;
sslServerCert = "/var/lib/acme/${domain}/cert.pem";
sslServerKey = "/var/lib/acme/${domain}/key.pem";
sslServerChain = "/var/lib/acme/${domain}/fullchain.pem";
+ logFormat = "combinedVhost";
+ listen = [ { ip = "*"; port = 443; } ];
};
apacheConfig = {
gzip = {
};
ldap = {
modules = [ "ldap" "authnz_ldap" ];
- extraConfig = assert mylibs.checkEnv "NIXOPS_HTTP_LDAP_PASSWORD"; ''
+ extraConfig = assert checkEnv "NIXOPS_HTTP_LDAP_PASSWORD"; ''
<IfModule ldap_module>
LDAPSharedCacheSize 500000
LDAPCacheEntries 1024
</Macro>
'';
};
+ http2 = {
+ modules = [ "http2" ];
+ extraConfig = ''
+ Protocols h2 http/1.1
+ '';
+ };
+ customLog = {
+ modules = [];
+ extraConfig = ''
+ LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %p" combinedVhost
+ '';
+ };
};
in rec {
enable = true;
logPerVirtualHost = true;
multiProcessingModule = "worker";
adminAddr = "httpd@immae.eu";
- # FIXME: http2
- # FIXME: voir les autres modules:
- # authz_core_module
- # reqtimeout_module
- # http2_module
- # version_module
- # proxy_connect_module
- # proxy_ftp_module
- # proxy_scgi_module
- # proxy_ajp_module
- # proxy_balancer_module
- # proxy_express_module
- # lbmethod_byrequests_module
- # lbmethod_bytraffic_module
- # lbmethod_bybusyness_module
- # lbmethod_heartbeat_module
-
+ logFormat = "combinedVhost";
extraModules = pkgs.lib.lists.unique (
mypkgs.adminer.apache.modules ++
mypkgs.nextcloud.apache.modules ++
extraConfig = builtins.concatStringsSep "\n"
(pkgs.lib.attrsets.mapAttrsToList (n: v: v.extraConfig) apacheConfig);
virtualHosts = [
- (withSSL "eldiron" // {
- listen = [ { ip = "*"; port = 443; } ];
+ (withConf "eldiron" // {
hostName = "eldiron.immae.eu";
documentRoot = ./www;
extraConfig = ''
DirectoryIndex index.htm
'';
})
- (withSSL "eldiron" // {
- listen = [ { ip = "*"; port = 443; } ];
+ (withConf "eldiron" // {
hostName = "db-1.immae.eu";
documentRoot = null;
extraConfig = builtins.concatStringsSep "\n" [
mypkgs.adminer.apache.vhostConf
];
})
- (withSSL "eldiron" // {
- listen = [ { ip = "*"; port = 443; } ];
+ (withConf "eldiron" // {
hostName = "tools.immae.eu";
documentRoot = null;
extraConfig = builtins.concatStringsSep "\n" [
mypkgs.ympd.apache.vhostConf
];
})
- (withSSL "eldiron" // {
- listen = [ { ip = "*"; port = 443; } ];
+ (withConf "eldiron" // {
hostName = "connexionswing.immae.eu";
serverAliases = [ "sandetludo.immae.eu" ];
documentRoot = mypkgs.connexionswing_dev.webRoot;
mypkgs.connexionswing_dev.apache.vhostConf
];
})
- (withSSL "eldiron" // {
- listen = [ { ip = "*"; port = 443; } ];
+ (withConf "eldiron" // {
hostName = "cloud.immae.eu";
documentRoot = mypkgs.nextcloud.webRoot;
extraConfig = builtins.concatStringsSep "\n" [
mypkgs.nextcloud.apache.vhostConf
];
})
- (withSSL "eldiron" // {
- listen = [ { ip = "*"; port = 443; } ];
+ (withConf "eldiron" // {
hostName = "git.immae.eu";
documentRoot = mypkgs.git.web.webRoot;
extraConfig = builtins.concatStringsSep "\n" [
hostName = "redirectSSL";
serverAliases = [ "*" ];
enableSSL = false;
+ logFormat = "combinedVhost";
documentRoot = "/var/lib/acme/acme-challenge";
extraConfig = ''
RewriteEngine on
security.pam.services = let
pam_ldap = pkgs.pam_ldap;
- pam_ldap_mysql = assert mylibs.checkEnv "NIXOPS_MYSQL_PAM_PASSWORD";
+ pam_ldap_mysql = assert checkEnv "NIXOPS_MYSQL_PAM_PASSWORD";
pkgs.writeText "mysql.conf" ''
host ldap.immae.eu
base dc=immae,dc=eu
# FIXME: ssl
services.mysql = rec {
enable = true;
- package = pkgs.mariadb.overrideAttrs(old: rec {
- cmakeFlags = old.cmakeFlags ++ [ "-DWITH_AUTHENTICATION_PAM=ON" ];
- buildInputs = old.buildInputs ++ [ pkgs.pam ];
- });
+ package = pkgs.mariadb;
};
# FIXME: initial sync
# FIXME: ssl
services.postgresql = rec {
enable = true;
- package = pkgs.postgresql100.overrideAttrs(old: rec {
- passthru = old.passthru // { psqlSchema = "11.0"; };
- name = "postgresql-11.1";
- src = pkgs.fetchurl {
- url = "mirror://postgresql/source/v11.1/${name}.tar.bz2";
- sha256 = "026v0sicsh7avzi45waf8shcbhivyxmi7qgn9fd1x0vl520mx0ch";
- };
- });
+ package = pkgs.postgresql;
enableTCPIP = true;
extraConfig = ''
max_connections = 100