From 2e7f0ada013810e577944434f42000313befe549 Mon Sep 17 00:00:00 2001
From: lassulus <lass@blue.r>
Date: Thu, 7 Jun 2018 08:24:56 +0200
Subject: [PATCH] l: kops -> krops

---
 lass/1systems/blue/config.nix |  8 ++++++++
 lass/1systems/mors/config.nix |  8 --------
 lass/{kops.nix => krops.nix}  | 17 ++++++++++++-----
 3 files changed, 20 insertions(+), 13 deletions(-)
 rename lass/{kops.nix => krops.nix} (57%)

diff --git a/lass/1systems/blue/config.nix b/lass/1systems/blue/config.nix
index aef055cf0..a84bb37f6 100644
--- a/lass/1systems/blue/config.nix
+++ b/lass/1systems/blue/config.nix
@@ -12,6 +12,14 @@ with import <stockholm/lib>;
 
   krebs.build.host = config.krebs.hosts.blue;
 
+  environment.shellAliases = {
+    deploy = pkgs.writeDash "deploy" ''
+      set -eu
+      export SYSTEM="$1"
+      $(nix-build $HOME/stockholm/lass/krops.nix --no-out-link --argstr name "$SYSTEM" -A deploy)
+    '';
+  };
+
   networking.nameservers = [ "1.1.1.1" ];
 
   lass.restic = genAttrs [
diff --git a/lass/1systems/mors/config.nix b/lass/1systems/mors/config.nix
index de6963eb5..97e69146e 100644
--- a/lass/1systems/mors/config.nix
+++ b/lass/1systems/mors/config.nix
@@ -140,14 +140,6 @@ with import <stockholm/lib>;
     OnCalendar = "00:37";
   };
 
-  environment.shellAliases = {
-    deploy = pkgs.writeDash "deploy" ''
-      set -eu
-      export SYSTEM="$1"
-      $(nix-build $HOME/stockholm/lass/kops.nix --no-out-link --argstr name "$SYSTEM" -A deploy)
-    '';
-  };
-
   nix.package = pkgs.nixUnstable;
   programs.adb.enable = true;
   users.users.mainUser.extraGroups = [ "adbusers" "docker" ];
diff --git a/lass/kops.nix b/lass/krops.nix
similarity index 57%
rename from lass/kops.nix
rename to lass/krops.nix
index 2dda0e8fb..776a3a55d 100644
--- a/lass/kops.nix
+++ b/lass/krops.nix
@@ -1,5 +1,5 @@
-{ name }: let
-  inherit (import ../krebs/kops.nix { inherit name; })
+{ config ? config, name }: let
+  inherit (import ../krebs/krops.nix { inherit name; })
     krebs-source
     lib
     pkgs
@@ -22,14 +22,21 @@
 
 in {
   # usage: $(nix-build --no-out-link --argstr name HOSTNAME -A deploy)
-  deploy = pkgs.kops.writeDeploy "${name}-deploy" {
+  deploy = pkgs.krops.writeDeploy "${name}-deploy" {
     source = source { test = false; };
     target = "root@${name}/var/src";
   };
 
   # usage: $(nix-build --no-out-link --argstr name HOSTNAME -A test)
-  test = pkgs.kops.writeTest "${name}-test" {
+  test = pkgs.krops.writeTest "${name}-test" {
     source = source { test = true; };
-    target = "${lib.getEnv "HOME"}/tmp/${name}-kops-test-src";
+    target = "${lib.getEnv "HOME"}/tmp/${name}-krops-test-src";
   };
+
+  ci = map (host:
+    pkgs.krops.writeTest "${host.name}-test" {
+      source = source { test = true; };
+      target = "${lib.getEnv "TMPDIR"}/lass/${host.name}";
+    }
+  ) (lib.filter (host: lib.getAttr "ci" host && host.owner == "lass") (lib.attrValues config.krebs.hosts));
 }