From 2e8711a58820fa84b4a14c6b6e754a614f22bc0e Mon Sep 17 00:00:00 2001 From: Quentin Aristote Date: Sun, 13 Nov 2022 21:21:00 +0100 Subject: use flakes --- tests/configuration.nix | 41 +++++++++++++++++++++++++++++++++++++++++ tests/run-tests.sh | 2 +- tests/vm.nix | 41 ----------------------------------------- 3 files changed, 42 insertions(+), 42 deletions(-) create mode 100644 tests/configuration.nix delete mode 100644 tests/vm.nix (limited to 'tests') diff --git a/tests/configuration.nix b/tests/configuration.nix new file mode 100644 index 0000000..e878c12 --- /dev/null +++ b/tests/configuration.nix @@ -0,0 +1,41 @@ +{ config, lib, ... }: + +let + nginxPorts = lib.concatLists + (lib.mapAttrsToList (_: cfg: (builtins.map (x: x.port) cfg.listen)) + config.services.nginx.virtualHosts); + nginxMakeLocal = port: { + listen = lib.mkForce [{ + inherit port; + addr = "0.0.0.0"; + }]; + forceSSL = lib.mkForce false; + enableACME = lib.mkForce false; + }; +in { + imports = [ ../configuration.nix ]; + + networking = lib.mkForce { + domain = "aristote.vm"; + + interfaces = { }; + defaultGateway = null; + nameservers = [ ]; + + firewall = { allowedTCPPorts = nginxPorts; }; + }; + + services.filtron.rules = lib.mkForce [ ]; + + services.nginx.virtualHosts = { + quentin = nginxMakeLocal 8080; + searx = nginxMakeLocal 8081; + money = nginxMakeLocal 8082; + rss = nginxMakeLocal 8083; + webkeydirectory = nginxMakeLocal 8084; + }; + + environment.etc."searx/secrets".text = '' + SECRET_KEY=secret_key + ''; +} diff --git a/tests/run-tests.sh b/tests/run-tests.sh index a55e282..b74a6fe 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -8,7 +8,7 @@ function cleanup { } sudo nixos-container stop hermes || exit 2 -sudo nixos-container update hermes --config-file ./vm.nix || exit 2 +sudo nixos-container update hermes --flake ..#hermes-test || exit 2 echo Starting container ... sudo nixos-container start hermes || exit 2 diff --git a/tests/vm.nix b/tests/vm.nix deleted file mode 100644 index e878c12..0000000 --- a/tests/vm.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ config, lib, ... }: - -let - nginxPorts = lib.concatLists - (lib.mapAttrsToList (_: cfg: (builtins.map (x: x.port) cfg.listen)) - config.services.nginx.virtualHosts); - nginxMakeLocal = port: { - listen = lib.mkForce [{ - inherit port; - addr = "0.0.0.0"; - }]; - forceSSL = lib.mkForce false; - enableACME = lib.mkForce false; - }; -in { - imports = [ ../configuration.nix ]; - - networking = lib.mkForce { - domain = "aristote.vm"; - - interfaces = { }; - defaultGateway = null; - nameservers = [ ]; - - firewall = { allowedTCPPorts = nginxPorts; }; - }; - - services.filtron.rules = lib.mkForce [ ]; - - services.nginx.virtualHosts = { - quentin = nginxMakeLocal 8080; - searx = nginxMakeLocal 8081; - money = nginxMakeLocal 8082; - rss = nginxMakeLocal 8083; - webkeydirectory = nginxMakeLocal 8084; - }; - - environment.etc."searx/secrets".text = '' - SECRET_KEY=secret_key - ''; -} -- cgit v1.2.3