From 383d8750236d58e9b7932a0c88a1245f95824045 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 13 Nov 2015 12:24:43 +0100 Subject: tinc_graphs: always restart --- krebs/3modules/tinc_graphs.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/tinc_graphs.nix b/krebs/3modules/tinc_graphs.nix index e415d20ab..20aa385a9 100644 --- a/krebs/3modules/tinc_graphs.nix +++ b/krebs/3modules/tinc_graphs.nix @@ -89,9 +89,9 @@ let }; restartIfChanged = true; - serviceConfig = { Type = "simple"; + restart = "always"; ExecStartPre = pkgs.writeScript "tinc_graphs-init" '' #!/bin/sh -- cgit v1.2.3 From 48c9789141957c0c65dcb4df5a0e22d6002cafd3 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 17 Nov 2015 12:16:51 +0100 Subject: apt-cacher-ng: init package and module once apt-cacher-ng arrives in nixos stable it will be removed from stockholm --- krebs/3modules/apt-cacher-ng.nix | 155 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 krebs/3modules/apt-cacher-ng.nix (limited to 'krebs/3modules') diff --git a/krebs/3modules/apt-cacher-ng.nix b/krebs/3modules/apt-cacher-ng.nix new file mode 100644 index 000000000..c2c2f2661 --- /dev/null +++ b/krebs/3modules/apt-cacher-ng.nix @@ -0,0 +1,155 @@ +{ config, pkgs, lib, ... }: + +with lib; +let + acng-config = pkgs.writeTextFile { + name = "acng-configuration"; + destination = "/acng.conf"; + text = '' + ForeGround: 1 + CacheDir: ${cfg.cacheDir} + LogDir: ${cfg.logDir} + PidFile: /var/run/apt-cacher-ng.pid + ExTreshold: ${toString cfg.cacheExpiration} + + Port: ${toString cfg.port} + BindAddress: ${cfg.bindAddress} + + # defaults: + Remap-debrep: file:deb_mirror*.gz /debian ; file:backends_debian + Remap-uburep: file:ubuntu_mirrors /ubuntu ; file:backends_ubuntu + Remap-debvol: file:debvol_mirror*.gz /debian-volatile ; file:backends_debvol + Remap-cygwin: file:cygwin_mirrors /cygwin + Remap-sfnet: file:sfnet_mirrors + Remap-alxrep: file:archlx_mirrors /archlinux + Remap-fedora: file:fedora_mirrors + Remap-epel: file:epel_mirrors + Remap-slrep: file:sl_mirrors # Scientific Linux + Remap-gentoo: file:gentoo_mirrors.gz /gentoo ; file:backends_gentoo + + ReportPage: acng-report.html + SupportDir: ${pkgs.apt-cacher-ng}/lib/apt-cacher-ng + LocalDirs: acng-doc ${pkgs.apt-cacher-ng}/share/doc/apt-cacher-ng + + # Nix cache + ${optionalString cfg.enableNixCache '' + Remap-nix: http://cache.nixos.org /nixos ; https://cache.nixos.org + PfilePatternEx: (^|.*?/).*\.narinfo(|\.gz|\.xz|\.bz2)$ + VfilePatternEx: (^|.*?/)nix-cache-info$ + ''} + + ${cfg.extraConfig} + ''; }; + + acng-home = "/var/cache/acng"; + cfg = config.krebs.apt-cacher-ng; + + api = { + enable = mkEnableOption "apt-cacher-ng"; + + cacheDir = mkOption { + default = acng-home + "/cache"; + type = types.str; + description = '' + Path to apt-cacher-ng cache directory. + Will be created and chowned to acng-user + ''; + }; + + logDir = mkOption { + default = acng-home + "/log"; + type = types.str; + description = '' + Path to apt-cacher-ng log directory. + Will be created and chowned to acng-user + ''; + }; + + port = mkOption { + default = 3142; + type = types.int; + description = '' + port of apt-cacher-ng + ''; + }; + + bindAddress = mkOption { + default = ""; + type = types.str; + example = "localhost 192.168.7.254 publicNameOnMainInterface"; + description = '' + listen address of apt-cacher-ng. Defaults to every interface. + ''; + }; + + cacheExpiration = mkOption { + default = 4; + type = types.int; + description = '' + number of days before packages expire in the cache without being + requested. + ''; + }; + + enableNixCache = mkOption { + default = true; + type = types.bool; + description = '' + enable cache.nixos.org caching via PfilePatternEx and VfilePatternEx. + + to use the apt-cacher-ng in your nixos configuration: + nix.binary-cache = [ http://acng-host:port/nixos ]; + + These options cannot be used in extraConfig, use SVfilePattern and + SPfilePattern or disable this option. + ''; + }; + + extraConfig = mkOption { + default = ""; + type = types.lines; + description = '' + extra config appended to the generated acng.conf + ''; + }; + }; + + imp = { + + users.extraUsers.acng = { + # uid = config.ids.uids.acng; + uid = 897955083; #genid Reaktor + description = "apt-cacher-ng"; + home = acng-home; + createHome = false; + }; + + users.extraGroups.acng = { + gid = 897955083; #genid Reaktor + # gid = config.ids.gids.Reaktor; + }; + + systemd.services.apt-cacher-ng = { + description = "apt-cacher-ng"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + PermissionsStartOnly = true; + ExecStartPre = pkgs.writeScript "acng-init" '' + #!/bin/sh + mkdir -p ${shell.escape cfg.cacheDir} ${shell.escape cfg.logDir} + chown acng:acng ${shell.escape cfg.cacheDir} ${shell.escape cfg.logDir} + ''; + ExecStart = "${pkgs.apt-cacher-ng}/bin/apt-cacher-ng -c ${acng-config}"; + PrivateTmp = "true"; + User = "acng"; + Restart = "always"; + RestartSec = "10"; + }; + }; + }; +in +{ + options.krebs.apt-cacher-ng = api; + config = mkIf cfg.enable imp; +} -- cgit v1.2.3 From 4c26fb9383a822309c05523774c9f7bebfbb5201 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 17 Nov 2015 13:29:56 +0100 Subject: k 3 apt-cacher-ng: fix whitespace --- krebs/3modules/apt-cacher-ng.nix | 69 ++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 34 deletions(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/apt-cacher-ng.nix b/krebs/3modules/apt-cacher-ng.nix index c2c2f2661..9224c72a0 100644 --- a/krebs/3modules/apt-cacher-ng.nix +++ b/krebs/3modules/apt-cacher-ng.nix @@ -6,40 +6,41 @@ let name = "acng-configuration"; destination = "/acng.conf"; text = '' - ForeGround: 1 - CacheDir: ${cfg.cacheDir} - LogDir: ${cfg.logDir} - PidFile: /var/run/apt-cacher-ng.pid - ExTreshold: ${toString cfg.cacheExpiration} - - Port: ${toString cfg.port} - BindAddress: ${cfg.bindAddress} - - # defaults: - Remap-debrep: file:deb_mirror*.gz /debian ; file:backends_debian - Remap-uburep: file:ubuntu_mirrors /ubuntu ; file:backends_ubuntu - Remap-debvol: file:debvol_mirror*.gz /debian-volatile ; file:backends_debvol - Remap-cygwin: file:cygwin_mirrors /cygwin - Remap-sfnet: file:sfnet_mirrors - Remap-alxrep: file:archlx_mirrors /archlinux - Remap-fedora: file:fedora_mirrors - Remap-epel: file:epel_mirrors - Remap-slrep: file:sl_mirrors # Scientific Linux - Remap-gentoo: file:gentoo_mirrors.gz /gentoo ; file:backends_gentoo - - ReportPage: acng-report.html - SupportDir: ${pkgs.apt-cacher-ng}/lib/apt-cacher-ng - LocalDirs: acng-doc ${pkgs.apt-cacher-ng}/share/doc/apt-cacher-ng - - # Nix cache - ${optionalString cfg.enableNixCache '' - Remap-nix: http://cache.nixos.org /nixos ; https://cache.nixos.org - PfilePatternEx: (^|.*?/).*\.narinfo(|\.gz|\.xz|\.bz2)$ - VfilePatternEx: (^|.*?/)nix-cache-info$ - ''} - - ${cfg.extraConfig} - ''; }; + ForeGround: 1 + CacheDir: ${cfg.cacheDir} + LogDir: ${cfg.logDir} + PidFile: /var/run/apt-cacher-ng.pid + ExTreshold: ${toString cfg.cacheExpiration} + + Port: ${toString cfg.port} + BindAddress: ${cfg.bindAddress} + + # defaults: + Remap-debrep: file:deb_mirror*.gz /debian ; file:backends_debian + Remap-uburep: file:ubuntu_mirrors /ubuntu ; file:backends_ubuntu + Remap-debvol: file:debvol_mirror*.gz /debian-volatile ; file:backends_debvol + Remap-cygwin: file:cygwin_mirrors /cygwin + Remap-sfnet: file:sfnet_mirrors + Remap-alxrep: file:archlx_mirrors /archlinux + Remap-fedora: file:fedora_mirrors + Remap-epel: file:epel_mirrors + Remap-slrep: file:sl_mirrors # Scientific Linux + Remap-gentoo: file:gentoo_mirrors.gz /gentoo ; file:backends_gentoo + + ReportPage: acng-report.html + SupportDir: ${pkgs.apt-cacher-ng}/lib/apt-cacher-ng + LocalDirs: acng-doc ${pkgs.apt-cacher-ng}/share/doc/apt-cacher-ng + + # Nix cache + ${optionalString cfg.enableNixCache '' + Remap-nix: http://cache.nixos.org /nixos ; https://cache.nixos.org + PfilePatternEx: (^|.*?/).*\.narinfo(|\.gz|\.xz|\.bz2)$ + VfilePatternEx: (^|.*?/)nix-cache-info$ + ''} + + ${cfg.extraConfig} + ''; + }; acng-home = "/var/cache/acng"; cfg = config.krebs.apt-cacher-ng; -- cgit v1.2.3 From 5a450ad787a4738d2338c1e6e2709a680ceeb413 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 17 Nov 2015 13:49:29 +0100 Subject: apt-cacher-ng is imported by krebs modules --- krebs/3modules/default.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'krebs/3modules') diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index 6d62b2e38..a627d5657 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -6,6 +6,7 @@ let out = { imports = [ + ./apt-cacher-ng.nix ./bepasty-server.nix ./build.nix ./current.nix -- cgit v1.2.3 From 5aed0a395b2f78216bc02a7178527034bb079d28 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 17 Nov 2015 22:15:07 +0100 Subject: shared wolf: static ip, fix todo --- krebs/3modules/default.nix | 1 + krebs/3modules/shared/default.nix | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix index a627d5657..ce52c148c 100644 --- a/krebs/3modules/default.nix +++ b/krebs/3modules/default.nix @@ -86,6 +86,7 @@ let krebs.dns.providers = { de.krebsco = "zones"; gg23 = "hosts"; + shack = "hosts"; internet = "hosts"; retiolum = "hosts"; }; diff --git a/krebs/3modules/shared/default.nix b/krebs/3modules/shared/default.nix index 13aae886b..d5bce469b 100644 --- a/krebs/3modules/shared/default.nix +++ b/krebs/3modules/shared/default.nix @@ -33,12 +33,17 @@ let in { hosts = addNames { wolf = { - #dc = "shack"; + dc = "shack"; nets = { - #shack = { - # addrs4 = [ TODO ]; - # aliases = ["wolf.shack"]; - #}; + shack = { + addrs4 = [ "10.42.2.136" ]; + aliases = [ + "wolf.shack" + "graphite.shack" + "acng.shack" + "drivedroid.shack" + ]; + }; retiolum = { addrs4 = ["10.243.77.1"]; addrs6 = ["42:0:0:0:0:0:77:1"]; -- cgit v1.2.3 From b8dea556e9ccaa999ccb8c18cab730ce535cd873 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 17 Nov 2015 22:26:11 +0100 Subject: k 3 shared: shack ip was already in use --- krebs/3modules/shared/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/shared/default.nix b/krebs/3modules/shared/default.nix index d5bce469b..b332676c6 100644 --- a/krebs/3modules/shared/default.nix +++ b/krebs/3modules/shared/default.nix @@ -36,7 +36,7 @@ in { dc = "shack"; nets = { shack = { - addrs4 = [ "10.42.2.136" ]; + addrs4 = [ "10.42.2.150" ]; aliases = [ "wolf.shack" "graphite.shack" -- cgit v1.2.3 From a3e074094b8c260825b0ae4caeb2170e562019a5 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 17 Nov 2015 23:03:21 +0100 Subject: k 3 apt-cacher-ng: add CAfile --- krebs/3modules/apt-cacher-ng.nix | 1 + 1 file changed, 1 insertion(+) (limited to 'krebs/3modules') diff --git a/krebs/3modules/apt-cacher-ng.nix b/krebs/3modules/apt-cacher-ng.nix index 9224c72a0..6f0ff8159 100644 --- a/krebs/3modules/apt-cacher-ng.nix +++ b/krebs/3modules/apt-cacher-ng.nix @@ -11,6 +11,7 @@ let LogDir: ${cfg.logDir} PidFile: /var/run/apt-cacher-ng.pid ExTreshold: ${toString cfg.cacheExpiration} + CAfile: ${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt Port: ${toString cfg.port} BindAddress: ${cfg.bindAddress} -- cgit v1.2.3 From 0f54a195b7d1a3b02bd70c31c2d05c2a1dc186bd Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 17 Nov 2015 23:11:29 +0100 Subject: acng: also add nar files to cache --- krebs/3modules/apt-cacher-ng.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/apt-cacher-ng.nix b/krebs/3modules/apt-cacher-ng.nix index 6f0ff8159..75296bafb 100644 --- a/krebs/3modules/apt-cacher-ng.nix +++ b/krebs/3modules/apt-cacher-ng.nix @@ -35,7 +35,7 @@ let # Nix cache ${optionalString cfg.enableNixCache '' Remap-nix: http://cache.nixos.org /nixos ; https://cache.nixos.org - PfilePatternEx: (^|.*?/).*\.narinfo(|\.gz|\.xz|\.bz2)$ + PfilePatternEx: (^|.*?/).*\.nar(info)?(|\.gz|\.xz|\.bz2)$ VfilePatternEx: (^|.*?/)nix-cache-info$ ''} -- cgit v1.2.3