diff options
author | makefu <github@syntax-fehler.de> | 2015-11-06 22:23:46 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2015-11-06 22:23:46 +0100 |
commit | 736e1426d5a7ec76d0987840552d56c6b4f0248e (patch) | |
tree | 944c5595dfbb2c66dfe934d48cc8349522c91aa8 /makefu | |
parent | 2dcb2918d1cd159d9282096ef3b5cecc4239bfbc (diff) | |
parent | 12597b1febb0bc47cf98529a12e5fc6af1d8f5a4 (diff) |
Merge branch 'master' of pnp:stockholm
Diffstat (limited to 'makefu')
-rw-r--r-- | makefu/1systems/wry.nix | 7 | ||||
-rw-r--r-- | makefu/2configs/headless.nix | 4 | ||||
-rw-r--r-- | makefu/2configs/nginx/euer.blog.nix | 34 | ||||
-rw-r--r-- | makefu/2configs/nginx/euer.wiki.nix | 13 |
4 files changed, 45 insertions, 13 deletions
diff --git a/makefu/1systems/wry.nix b/makefu/1systems/wry.nix index c90b84451..90710c857 100644 --- a/makefu/1systems/wry.nix +++ b/makefu/1systems/wry.nix @@ -8,7 +8,8 @@ let in { imports = [ # TODO: copy this config or move to krebs - ../../tv/2configs/CAC-CentOS-7-64bit.nix + ../../tv/2configs/hw/CAC.nix + ../../tv/2configs/fs/CAC-CentOS-7-64bit.nix ../2configs/base.nix ../2configs/unstable-sources.nix ../2configs/headless.nix @@ -23,6 +24,8 @@ in { # other nginx ../2configs/nginx/euer.wiki.nix + ../2configs/nginx/euer.blog.nix + # collectd ../2configs/collectd/collectd-base.nix ]; @@ -71,5 +74,5 @@ in { nameservers = [ "8.8.8.8" ]; }; - + environment.systemPackages = [ pkgs.translate-shell ]; } diff --git a/makefu/2configs/headless.nix b/makefu/2configs/headless.nix index 33847c5e1..772ca3771 100644 --- a/makefu/2configs/headless.nix +++ b/makefu/2configs/headless.nix @@ -1,4 +1,4 @@ -_: +{lib,... }: { - sound.enable = false; + sound.enable = lib.mkForce false; } diff --git a/makefu/2configs/nginx/euer.blog.nix b/makefu/2configs/nginx/euer.blog.nix index e97050ec4..c6724c617 100644 --- a/makefu/2configs/nginx/euer.blog.nix +++ b/makefu/2configs/nginx/euer.blog.nix @@ -5,14 +5,40 @@ let sec = toString <secrets>; ssl_cert = "${sec}/wildcard.krebsco.de.crt"; ssl_key = "${sec}/wildcard.krebsco.de.key"; - hostname = krebs.build.host.name; + hostname = config.krebs.build.host.name; + user = config.services.nginx.user; + group = config.services.nginx.group; + external-ip = head config.krebs.build.host.nets.internet.addrs4; + internal-ip = head config.krebs.build.host.nets.retiolum.addrs4; + base-dir = "/var/www/blog.euer"; in { + # Prepare Blog directory + systemd.services.prepare-euer-blog = { + wantedBy = [ "local-fs.target" ]; + before = [ "nginx.service" ]; + serviceConfig = { + # do nothing if the base dir already exists + ExecStart = pkgs.writeScript "prepare-euer-blog-service" '' + #!/bin/sh + if ! test -d "${base-dir}" ;then + mkdir -p "${base-dir}" + chown ${user}:${group} "${base-dir}" + chmod 700 "${base-dir}" + fi + ''; + Type = "oneshot"; + RemainAfterExit = "yes"; + TimeoutSec = "0"; + }; + }; + krebs.nginx = { enable = mkDefault true; servers = { euer-blog = { - listen = [ "80" "443 ssl" ]; - server-names = [ "euer.krebsco.de" "euer.blog.krebsco.de" "blog.${hostname}" ]; + listen = [ "${external-ip}:80" "${external-ip}:443 ssl" + "${internal-ip}:80" "${internal-ip}:443 ssl" ]; + server-names = [ "euer.krebsco.de" "blog.euer.krebsco.de" "blog.${hostname}" ]; extraConfig = '' gzip on; gzip_buffers 4 32k; @@ -22,7 +48,7 @@ in { default_type text/plain; ''; locations = singleton (nameValuePair "/" '' - root /var/www/euer.blog/; + root ${base-dir}; ''); }; }; diff --git a/makefu/2configs/nginx/euer.wiki.nix b/makefu/2configs/nginx/euer.wiki.nix index fbcfe2047..2b5fa6ead 100644 --- a/makefu/2configs/nginx/euer.wiki.nix +++ b/makefu/2configs/nginx/euer.wiki.nix @@ -51,18 +51,21 @@ in { serviceConfig = { ExecStart = pkgs.writeScript "prepare-tw-service" '' #!/bin/sh - mkdir -p "${wiki-dir}" "${backup-dir}" + if ! test -d "${base-dir}" ;then + mkdir -p "${wiki-dir}" "${backup-dir}" - # write the base configuration - cat > "${base-cfg}" <<EOF + # write the base configuration + cat > "${base-cfg}" <<EOF [users] $(cat "${tw-pass-file}") [directories] backupdir = ${backup-dir} savedir = ${wiki-dir} EOF - chown -R ${user}:${group} "${base-dir}" - chmod 700 -R "${base-dir}" + + chown -R ${user}:${group} "${base-dir}" + chmod 700 -R "${base-dir}" + fi ''; Type = "oneshot"; RemainAfterExit = "yes"; |