From 23c7c10f5a5ed83dca001d7382e5b89981277f8c Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 6 Feb 2016 15:11:30 +0100 Subject: krebs.retiolum.hosts: change type to attrsOf host --- krebs/3modules/retiolum.nix | 46 +++++++++++++++++----------------- krebs/4lib/types.nix | 16 ++++++------ krebs/Zhosts/Styx | 10 -------- krebs/Zhosts/ThinkArmageddon | 9 ------- krebs/Zhosts/TriBot | 11 -------- krebs/Zhosts/ach | 11 -------- krebs/Zhosts/air | 11 -------- krebs/Zhosts/alarmpi | 11 -------- krebs/Zhosts/albi10 | 11 -------- krebs/Zhosts/albi7 | 10 -------- krebs/Zhosts/almoehi | 11 -------- krebs/Zhosts/alphalabs | 10 -------- krebs/Zhosts/apfull | 11 -------- krebs/Zhosts/bitchctl | 11 -------- krebs/Zhosts/bitchextend | 11 -------- krebs/Zhosts/bitchtop | 11 -------- krebs/Zhosts/bobby | 11 -------- krebs/Zhosts/box | 10 -------- krebs/Zhosts/bridge | 12 --------- krebs/Zhosts/c2ft | 10 -------- krebs/Zhosts/c2fthome | 10 -------- krebs/Zhosts/casino | 11 -------- krebs/Zhosts/cat1 | 11 -------- krebs/Zhosts/cband | 11 -------- krebs/Zhosts/cd | 17 ------------- krebs/Zhosts/cloudkrebs | 12 --------- krebs/Zhosts/darth | 12 --------- krebs/Zhosts/dei | 11 -------- krebs/Zhosts/destroy | 11 -------- krebs/Zhosts/devstar | 11 -------- krebs/Zhosts/echelon | 12 --------- krebs/Zhosts/eigenserv | 11 -------- krebs/Zhosts/elvis | 12 --------- krebs/Zhosts/eulerwalk | 11 -------- krebs/Zhosts/exile | 9 ------- krebs/Zhosts/exitium_mobilis | 10 -------- krebs/Zhosts/falk | 11 -------- krebs/Zhosts/fastpoke | 12 --------- krebs/Zhosts/filebitch | 11 -------- krebs/Zhosts/filepimp | 11 -------- krebs/Zhosts/flap | 12 --------- krebs/Zhosts/foobar | 11 -------- krebs/Zhosts/fuerkrebs | 10 -------- krebs/Zhosts/gum | 15 ----------- krebs/Zhosts/heidi | 11 -------- krebs/Zhosts/horisa | 12 --------- krebs/Zhosts/horreum_magnus | 15 ----------- krebs/Zhosts/incept | 13 ---------- krebs/Zhosts/ire | 12 --------- krebs/Zhosts/ire2 | 9 ------- krebs/Zhosts/irkel | 12 --------- krebs/Zhosts/juhulian | 11 -------- krebs/Zhosts/k2 | 28 --------------------- krebs/Zhosts/kabinett | 11 -------- krebs/Zhosts/kaepsele | 11 -------- krebs/Zhosts/kalle | 11 -------- krebs/Zhosts/karthus | 10 -------- krebs/Zhosts/kebsco | 11 -------- krebs/Zhosts/khackplug | 11 -------- krebs/Zhosts/kheurop | 12 --------- krebs/Zhosts/kiosk | 12 --------- krebs/Zhosts/krebsplug | 10 -------- krebs/Zhosts/kvasir | 11 -------- krebs/Zhosts/laqueus | 11 -------- krebs/Zhosts/linuxatom | 11 -------- krebs/Zhosts/luminos | 11 -------- krebs/Zhosts/machine | 11 -------- krebs/Zhosts/makalu | 11 -------- krebs/Zhosts/mako | 11 -------- krebs/Zhosts/miefda0 | 10 -------- krebs/Zhosts/minikrebs | 10 -------- krebs/Zhosts/mkdir | 11 -------- krebs/Zhosts/monitor | 11 -------- krebs/Zhosts/mors | 10 -------- krebs/Zhosts/motor | 12 --------- krebs/Zhosts/mu | 10 -------- krebs/Zhosts/muhbaasu | 13 ---------- krebs/Zhosts/nomic | 10 -------- krebs/Zhosts/nomic2 | 10 -------- krebs/Zhosts/nukular | 11 -------- krebs/Zhosts/omo | 9 ------- krebs/Zhosts/pic | 11 -------- krebs/Zhosts/pigstarter | 13 ---------- krebs/Zhosts/pike | 11 -------- krebs/Zhosts/pnp | 11 -------- krebs/Zhosts/pornocauster | 10 -------- krebs/Zhosts/prism | 12 --------- krebs/Zhosts/radiotuxmini | 11 -------- krebs/Zhosts/random | 10 -------- krebs/Zhosts/raspafari | 11 -------- krebs/Zhosts/reimae | 12 --------- krebs/Zhosts/rmdir | 11 -------- krebs/Zhosts/robchina | 11 -------- krebs/Zhosts/rockit | 11 -------- krebs/Zhosts/rtjure_debian_oder_so | 11 -------- krebs/Zhosts/rtjure_ras | 11 -------- krebs/Zhosts/rtjure_rdrlab_linkstation | 11 -------- krebs/Zhosts/rubus | 9 ------- krebs/Zhosts/senderechner | 10 -------- krebs/Zhosts/serenity | 11 -------- krebs/Zhosts/seruundroid | 12 --------- krebs/Zhosts/sir_krebs_a_lot | 11 -------- krebs/Zhosts/skirfir | 11 -------- krebs/Zhosts/sleipnir | 12 --------- krebs/Zhosts/smove | 9 ------- krebs/Zhosts/sokrates | 11 -------- krebs/Zhosts/sokrateslaptop | 11 -------- krebs/Zhosts/soundflower | 10 -------- krebs/Zhosts/steve | 10 -------- krebs/Zhosts/stro | 10 -------- krebs/Zhosts/tahoe | 12 --------- krebs/Zhosts/taschenkrebs | 11 -------- krebs/Zhosts/terrapi | 11 -------- krebs/Zhosts/thomasDOTde | 9 ------- krebs/Zhosts/tincdroid | 9 ------- krebs/Zhosts/tmpd | 11 -------- krebs/Zhosts/tpsw | 11 -------- krebs/Zhosts/tsp | 16 ------------ krebs/Zhosts/ufo | 11 -------- krebs/Zhosts/uriel | 11 -------- krebs/Zhosts/vault | 10 -------- krebs/Zhosts/vbob | 9 ------- krebs/Zhosts/voyager | 17 ------------- krebs/Zhosts/wbob | 10 -------- krebs/Zhosts/wolf | 10 -------- krebs/Zhosts/wooktop | 11 -------- krebs/Zhosts/wry | 16 ------------ krebs/Zhosts/wu | 10 -------- krebs/Zhosts/xu | 13 ---------- krebs/Zhosts/ytart | 9 ------- krebs/Zhosts/zombiecancer | 11 -------- 131 files changed, 32 insertions(+), 1476 deletions(-) delete mode 100644 krebs/Zhosts/Styx delete mode 100644 krebs/Zhosts/ThinkArmageddon delete mode 100644 krebs/Zhosts/TriBot delete mode 100644 krebs/Zhosts/ach delete mode 100644 krebs/Zhosts/air delete mode 100644 krebs/Zhosts/alarmpi delete mode 100644 krebs/Zhosts/albi10 delete mode 100644 krebs/Zhosts/albi7 delete mode 100644 krebs/Zhosts/almoehi delete mode 100644 krebs/Zhosts/alphalabs delete mode 100644 krebs/Zhosts/apfull delete mode 100644 krebs/Zhosts/bitchctl delete mode 100644 krebs/Zhosts/bitchextend delete mode 100644 krebs/Zhosts/bitchtop delete mode 100644 krebs/Zhosts/bobby delete mode 100644 krebs/Zhosts/box delete mode 100644 krebs/Zhosts/bridge delete mode 100644 krebs/Zhosts/c2ft delete mode 100644 krebs/Zhosts/c2fthome delete mode 100644 krebs/Zhosts/casino delete mode 100644 krebs/Zhosts/cat1 delete mode 100644 krebs/Zhosts/cband delete mode 100644 krebs/Zhosts/cd delete mode 100644 krebs/Zhosts/cloudkrebs delete mode 100644 krebs/Zhosts/darth delete mode 100644 krebs/Zhosts/dei delete mode 100644 krebs/Zhosts/destroy delete mode 100644 krebs/Zhosts/devstar delete mode 100644 krebs/Zhosts/echelon delete mode 100644 krebs/Zhosts/eigenserv delete mode 100644 krebs/Zhosts/elvis delete mode 100644 krebs/Zhosts/eulerwalk delete mode 100644 krebs/Zhosts/exile delete mode 100644 krebs/Zhosts/exitium_mobilis delete mode 100644 krebs/Zhosts/falk delete mode 100644 krebs/Zhosts/fastpoke delete mode 100644 krebs/Zhosts/filebitch delete mode 100644 krebs/Zhosts/filepimp delete mode 100644 krebs/Zhosts/flap delete mode 100644 krebs/Zhosts/foobar delete mode 100644 krebs/Zhosts/fuerkrebs delete mode 100644 krebs/Zhosts/gum delete mode 100644 krebs/Zhosts/heidi delete mode 100644 krebs/Zhosts/horisa delete mode 100644 krebs/Zhosts/horreum_magnus delete mode 100644 krebs/Zhosts/incept delete mode 100644 krebs/Zhosts/ire delete mode 100644 krebs/Zhosts/ire2 delete mode 100644 krebs/Zhosts/irkel delete mode 100644 krebs/Zhosts/juhulian delete mode 100644 krebs/Zhosts/k2 delete mode 100644 krebs/Zhosts/kabinett delete mode 100644 krebs/Zhosts/kaepsele delete mode 100644 krebs/Zhosts/kalle delete mode 100644 krebs/Zhosts/karthus delete mode 100644 krebs/Zhosts/kebsco delete mode 100644 krebs/Zhosts/khackplug delete mode 100644 krebs/Zhosts/kheurop delete mode 100644 krebs/Zhosts/kiosk delete mode 100644 krebs/Zhosts/krebsplug delete mode 100644 krebs/Zhosts/kvasir delete mode 100644 krebs/Zhosts/laqueus delete mode 100644 krebs/Zhosts/linuxatom delete mode 100644 krebs/Zhosts/luminos delete mode 100644 krebs/Zhosts/machine delete mode 100644 krebs/Zhosts/makalu delete mode 100644 krebs/Zhosts/mako delete mode 100644 krebs/Zhosts/miefda0 delete mode 100644 krebs/Zhosts/minikrebs delete mode 100644 krebs/Zhosts/mkdir delete mode 100644 krebs/Zhosts/monitor delete mode 100644 krebs/Zhosts/mors delete mode 100644 krebs/Zhosts/motor delete mode 100644 krebs/Zhosts/mu delete mode 100644 krebs/Zhosts/muhbaasu delete mode 100644 krebs/Zhosts/nomic delete mode 100644 krebs/Zhosts/nomic2 delete mode 100644 krebs/Zhosts/nukular delete mode 100644 krebs/Zhosts/omo delete mode 100644 krebs/Zhosts/pic delete mode 100644 krebs/Zhosts/pigstarter delete mode 100644 krebs/Zhosts/pike delete mode 100644 krebs/Zhosts/pnp delete mode 100644 krebs/Zhosts/pornocauster delete mode 100644 krebs/Zhosts/prism delete mode 100644 krebs/Zhosts/radiotuxmini delete mode 100644 krebs/Zhosts/random delete mode 100644 krebs/Zhosts/raspafari delete mode 100644 krebs/Zhosts/reimae delete mode 100644 krebs/Zhosts/rmdir delete mode 100644 krebs/Zhosts/robchina delete mode 100644 krebs/Zhosts/rockit delete mode 100644 krebs/Zhosts/rtjure_debian_oder_so delete mode 100644 krebs/Zhosts/rtjure_ras delete mode 100644 krebs/Zhosts/rtjure_rdrlab_linkstation delete mode 100644 krebs/Zhosts/rubus delete mode 100644 krebs/Zhosts/senderechner delete mode 100644 krebs/Zhosts/serenity delete mode 100644 krebs/Zhosts/seruundroid delete mode 100644 krebs/Zhosts/sir_krebs_a_lot delete mode 100644 krebs/Zhosts/skirfir delete mode 100644 krebs/Zhosts/sleipnir delete mode 100644 krebs/Zhosts/smove delete mode 100644 krebs/Zhosts/sokrates delete mode 100644 krebs/Zhosts/sokrateslaptop delete mode 100644 krebs/Zhosts/soundflower delete mode 100644 krebs/Zhosts/steve delete mode 100644 krebs/Zhosts/stro delete mode 100644 krebs/Zhosts/tahoe delete mode 100644 krebs/Zhosts/taschenkrebs delete mode 100644 krebs/Zhosts/terrapi delete mode 100644 krebs/Zhosts/thomasDOTde delete mode 100644 krebs/Zhosts/tincdroid delete mode 100644 krebs/Zhosts/tmpd delete mode 100644 krebs/Zhosts/tpsw delete mode 100644 krebs/Zhosts/tsp delete mode 100644 krebs/Zhosts/ufo delete mode 100644 krebs/Zhosts/uriel delete mode 100644 krebs/Zhosts/vault delete mode 100644 krebs/Zhosts/vbob delete mode 100644 krebs/Zhosts/voyager delete mode 100644 krebs/Zhosts/wbob delete mode 100644 krebs/Zhosts/wolf delete mode 100644 krebs/Zhosts/wooktop delete mode 100644 krebs/Zhosts/wry delete mode 100644 krebs/Zhosts/wu delete mode 100644 krebs/Zhosts/xu delete mode 100644 krebs/Zhosts/ytart delete mode 100644 krebs/Zhosts/zombiecancer (limited to 'krebs') diff --git a/krebs/3modules/retiolum.nix b/krebs/3modules/retiolum.nix index e0e2692a8..08ac96461 100644 --- a/krebs/3modules/retiolum.nix +++ b/krebs/3modules/retiolum.nix @@ -1,6 +1,4 @@ { config, pkgs, lib, ... }: - -with builtins; with lib; let cfg = config.krebs.retiolum; @@ -40,7 +38,7 @@ let ''; }; - network = mkOption { + netname = mkOption { type = types.str; default = "retiolum"; description = '' @@ -65,10 +63,13 @@ let }; hosts = mkOption { - type = with types; either package path; - default = ../Zhosts; + type = with types; attrsOf host; + default = + filterAttrs (_: h: hasAttr cfg.netname h.nets) config.krebs.hosts; description = '' - If a path is given, then it will be used to generate an ad-hoc package. + Hosts which should be part of the tinc configuration. + Note that these hosts must have a correspondingly named network + configured, see config.krebs.retiolum.netname. ''; }; @@ -104,7 +105,7 @@ let }; imp = { - environment.systemPackages = [ tinc hosts iproute ]; + environment.systemPackages = [ tinc iproute ]; networking.extraHosts = retiolumExtraHosts; @@ -140,17 +141,16 @@ let tinc = cfg.tincPackage; - hosts = getAttr (typeOf cfg.hosts) { - package = cfg.hosts; - path = pkgs.stdenv.mkDerivation { - name = "custom-retiolum-hosts"; - src = cfg.hosts; - installPhase = '' - mkdir $out - find . -name .git -prune -o -type f -print0 \ - | xargs -0 cp --target-directory $out - ''; - }; + tinc-hosts = pkgs.stdenv.mkDerivation { + name = "${cfg.netname}-tinc-hosts"; + phases = [ "installPhase" ]; + installPhase = '' + mkdir $out + ${concatStrings (mapAttrsToList (_: host: '' + echo ${shell.escape host.nets.${cfg.netname}.tinc.config} \ + > $out/${shell.escape host.name} + '') cfg.hosts)} + ''; }; iproute = cfg.iproutePackage; @@ -159,7 +159,7 @@ let { } '' generate() { - (cd ${hosts} + (cd ${tinc-hosts} printf \'\' for i in `ls`; do names=$(hostnames $i) @@ -180,11 +180,11 @@ let generate ;; long) - hostnames() { echo "$1.${cfg.network}"; } + hostnames() { echo "$1.${cfg.netname}"; } generate ;; both) - hostnames() { echo "$1.${cfg.network} $1"; } + hostnames() { echo "$1.${cfg.netname} $1"; } generate ;; *) @@ -203,12 +203,12 @@ let mkdir -p $out - ln -s ${hosts} $out/hosts + ln -s ${tinc-hosts} $out/hosts cat > $out/tinc.conf <