From 6eacc17157fe28bb89f9d9d5d1595de4232b7ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Mon, 24 Sep 2018 20:06:31 +0100 Subject: [PATCH] nixos tests: move common configuration into separate file This allows tests outside nixos to use acme setup. --- nixos/tests/acme.nix | 29 +---------------------- nixos/tests/common/letsencrypt/common.nix | 27 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 28 deletions(-) create mode 100644 nixos/tests/common/letsencrypt/common.nix diff --git a/nixos/tests/acme.nix b/nixos/tests/acme.nix index c7fd4910e07..4669a092433 100644 --- a/nixos/tests/acme.nix +++ b/nixos/tests/acme.nix @@ -1,32 +1,5 @@ let - commonConfig = { 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; - }); - }; - + commonConfig = ./common/letsencrypt/common.nix; in import ./make-test.nix { name = "acme"; diff --git a/nixos/tests/common/letsencrypt/common.nix b/nixos/tests/common/letsencrypt/common.nix new file mode 100644 index 00000000000..798a749f7f9 --- /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; + }); +}