From 5f50006d7828fc5a5865de6182d5c118b2f72cc1 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 15 Apr 2017 14:32:05 +0200 Subject: tv nixpkgs: 5acb454 -> 76c6313 --- tv/2configs/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index cbbd5c439..8d7ed2b4f 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -14,7 +14,7 @@ with import ; stockholm.file = "/home/tv/stockholm"; nixpkgs.git = { url = https://github.com/NixOS/nixpkgs; - ref = "5acb454e2ad3e3783e63b86a9a31e800d2507e66"; # nixos-17.03 + ref = "76c63133c5310d362c7c23157616b263db9a9510"; # nixos-17.03 }; } // optionalAttrs host.secure { secrets-master.file = "/home/tv/secrets/master"; -- cgit v1.2.3 From 91f5c5cebec3cb1a38fac6e69b961fa01312115a Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 17 Apr 2017 13:46:38 +0200 Subject: tv nixpkgs: 76c6313 -> b647a67 --- tv/2configs/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index 8d7ed2b4f..ede73f4e5 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -14,7 +14,7 @@ with import ; stockholm.file = "/home/tv/stockholm"; nixpkgs.git = { url = https://github.com/NixOS/nixpkgs; - ref = "76c63133c5310d362c7c23157616b263db9a9510"; # nixos-17.03 + ref = "b647a67dfee066b75d2f54b789f7646016662071"; # nixos-17.03 }; } // optionalAttrs host.secure { secrets-master.file = "/home/tv/secrets/master"; -- cgit v1.2.3 From 662ef4ee697cc07524ba0654ebf2ebcf30ee2b18 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 17 Apr 2017 15:45:32 +0200 Subject: wolf: cleanup --- shared/1systems/wolf.nix | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/shared/1systems/wolf.nix b/shared/1systems/wolf.nix index 722a08812..0b4448022 100644 --- a/shared/1systems/wolf.nix +++ b/shared/1systems/wolf.nix @@ -1,20 +1,18 @@ -{ config, lib, pkgs, ... }: - +{ config, pkgs, ... }: let shack-ip = config.krebs.build.host.nets.shack.ip4.addr; - internal-ip = config.krebs.build.host.nets.retiolum.ip4.addr; in { imports = [ ../. + ../2configs/cgit-mirror.nix ../2configs/collectd-base.nix - ../2configs/shack-nix-cacher.nix + ../2configs/graphite.nix + ../2configs/repo-sync.nix ../2configs/shack-drivedroid.nix + ../2configs/shack-nix-cacher.nix ../2configs/shared-buildbot.nix - ../2configs/cgit-mirror.nix - ../2configs/repo-sync.nix - ../2configs/graphite.nix ../2configs/share-shack.nix ]; # use your own binary cache, fallback use cache.nixos.org (which is used by -- cgit v1.2.3 From 48de4d6ae353d7df0259b53d01c97c12fdb6dd66 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 17 Apr 2017 15:46:45 +0200 Subject: shared shack-drivedroid: krebs.nginx -> services.nginx --- shared/2configs/shack-drivedroid.nix | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/shared/2configs/shack-drivedroid.nix b/shared/2configs/shack-drivedroid.nix index 3581f9e96..07fcffa42 100644 --- a/shared/2configs/shack-drivedroid.nix +++ b/shared/2configs/shack-drivedroid.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, config, ... }: +{ config, pkgs, ... }: with import ; let repodir = "/var/srv/drivedroid"; @@ -7,6 +7,20 @@ in { environment.systemPackages = [ pkgs.drivedroid-gen-repo ]; + services.nginx = { + enable = mkDefault true; + virtualHosts.shack-drivedroid = { + serverAliases = [ + "drivedroid.shack" + ]; + # TODO: prepare this somehow + locations."/".extraConfig = '' + root ${repodir}; + index main.json; + ''; + }; + }; + systemd.services.drivedroid = { description = "generates drivedroid repo file"; restartIfChanged = true; @@ -27,18 +41,4 @@ in ''; }; }; - - krebs.nginx = { - enable = lib.mkDefault true; - servers = { - drivedroid-repo = { - server-names = [ "drivedroid.shack" ]; - # TODO: prepare this somehow - locations = lib.singleton (lib.nameValuePair "/" '' - root ${repodir}; - index main.json; - ''); - }; - }; - }; } -- cgit v1.2.3 From 0b89efb90ee7e8d4d39246da7dcde4d4bb7ad273 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 17 Apr 2017 15:47:07 +0200 Subject: shared shack-nix-cacher: krebs.nginx -> services.nginx --- shared/2configs/shack-nix-cacher.nix | 37 +++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/shared/2configs/shack-nix-cacher.nix b/shared/2configs/shack-nix-cacher.nix index 7519bb3ac..4fcbf3a4e 100644 --- a/shared/2configs/shack-nix-cacher.nix +++ b/shared/2configs/shack-nix-cacher.nix @@ -1,25 +1,28 @@ -{ pkgs, lib, ... }: - +{ config, pkgs, ... }: +with import ; +let + cfg = config.krebs.apt-cacher-ng; +in { - krebs.nginx = { - enable = lib.mkDefault true; - servers = { - apt-cacher-ng = { - server-names = [ "acng.shack" ]; - locations = lib.singleton (lib.nameValuePair "/" '' - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_pass http://localhost:3142/; - ''); - }; - }; - }; - krebs.apt-cacher-ng = { enable = true; port = 3142; bindAddress = "localhost"; cacheExpiration = 30; }; + + services.nginx = { + enable = mkDefault true; + virtualHosts.shack-nix-cacher = { + serverAliases = [ + "acng.shack" + ]; + locations."/".extraConfig = '' + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://localhost:${toString cfg.port}/; + ''; + }; + }; } -- cgit v1.2.3 From 9cb758c1cbabdfc8f186d78d52992510766f934e Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 17 Apr 2017 15:59:27 +0200 Subject: shared shack-drivedroid: cleanup --- shared/2configs/shack-drivedroid.nix | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/shared/2configs/shack-drivedroid.nix b/shared/2configs/shack-drivedroid.nix index 07fcffa42..12e4a39c3 100644 --- a/shared/2configs/shack-drivedroid.nix +++ b/shared/2configs/shack-drivedroid.nix @@ -1,8 +1,7 @@ { config, pkgs, ... }: with import ; let - repodir = "/var/srv/drivedroid"; - srepodir = shell.escape repodir; + root = "/var/srv/drivedroid"; in { environment.systemPackages = [ pkgs.drivedroid-gen-repo ]; @@ -15,28 +14,34 @@ in ]; # TODO: prepare this somehow locations."/".extraConfig = '' - root ${repodir}; + root ${root}; index main.json; ''; }; }; - systemd.services.drivedroid = { + systemd.services.drivedroid-gen-repo = { description = "generates drivedroid repo file"; - restartIfChanged = true; + path = [ + pkgs.coreutils + pkgs.drivedroid-gen-repo + pkgs.inotify-tools + ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "simple"; Restart = "always"; - ExecStartPre = pkgs.writeScript "prepare-drivedroid-gen-repo" '' - #!/bin/sh - mkdir -p ${srepodir}/repos + ExecStartPre = pkgs.writeDash "prepare-drivedroid-gen-repo" '' + mkdir -p ${root}/repos ''; - ExecStart = pkgs.writeScript "start-drivedroid-gen-repo" '' - #!/bin/sh + ExecStart = pkgs.writeDash "start-drivedroid-gen-repo" '' + set -efu + cd ${root} while sleep 60; do - ${pkgs.inotify-tools}/bin/inotifywait -r ${srepodir} && ${pkgs.drivedroid-gen-repo}/bin/drivedroid-gen-repo --chdir "${srepodir}" repos/ > "${srepodir}/main.json" + if inotifywait -r .; then + drivedroid-gen-repo repos > main.json + fi done ''; }; -- cgit v1.2.3