summary refs log tree commit diff
path: root/nixos/tests/common
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2018-09-24 20:06:31 +0100
committerDomen Kožar <domen@dev.si>2018-09-24 20:07:33 +0100
commit6eacc17157fe28bb89f9d9d5d1595de4232b7ba7 (patch)
tree256dda216b0616edfa3ae8a7f45f139ab9b3498d /nixos/tests/common
parentf37b39d279d111bfefbae1ba56cc97b535b93a06 (diff)
downloadnixlib-6eacc17157fe28bb89f9d9d5d1595de4232b7ba7.tar
nixlib-6eacc17157fe28bb89f9d9d5d1595de4232b7ba7.tar.gz
nixlib-6eacc17157fe28bb89f9d9d5d1595de4232b7ba7.tar.bz2
nixlib-6eacc17157fe28bb89f9d9d5d1595de4232b7ba7.tar.lz
nixlib-6eacc17157fe28bb89f9d9d5d1595de4232b7ba7.tar.xz
nixlib-6eacc17157fe28bb89f9d9d5d1595de4232b7ba7.tar.zst
nixlib-6eacc17157fe28bb89f9d9d5d1595de4232b7ba7.zip
nixos tests: move common configuration into separate file
This allows tests outside nixos to use acme setup.
Diffstat (limited to 'nixos/tests/common')
-rw-r--r--nixos/tests/common/letsencrypt/common.nix27
1 files changed, 27 insertions, 0 deletions
diff --git a/nixos/tests/common/letsencrypt/common.nix b/nixos/tests/common/letsencrypt/common.nix
new file mode 100644
index 000000000000..798a749f7f9b
--- /dev/null
+++ b/nixos/tests/common/letsencrypt/common.nix
@@ -0,0 +1,27 @@
+{ lib, nodes, ... }: {
+  networking.nameservers = [
+    nodes.letsencrypt.config.networking.primaryIPAddress
+  ];
+
+  nixpkgs.overlays = lib.singleton (self: super: {
+    cacert = super.cacert.overrideDerivation (drv: {
+      installPhase = (drv.installPhase or "") + ''
+        cat "${nodes.letsencrypt.config.test-support.letsencrypt.caCert}" \
+          >> "$out/etc/ssl/certs/ca-bundle.crt"
+      '';
+    });
+
+    # Override certifi so that it accepts fake certificate for Let's Encrypt
+    # Need to override the attribute used by simp_le, which is python3Packages
+    python3Packages = (super.python3.override {
+      packageOverrides = lib.const (pysuper: {
+        certifi = pysuper.certifi.overridePythonAttrs (attrs: {
+          postPatch = (attrs.postPatch or "") + ''
+            cat "${self.cacert}/etc/ssl/certs/ca-bundle.crt" \
+              > certifi/cacert.pem
+          '';
+        });
+      });
+    }).pkgs;
+  });
+}