From 8f0e518bc04b931d2e20cfa79caf20c4ff8a5ea2 Mon Sep 17 00:00:00 2001 From: GTrunSec Date: Sat, 3 Apr 2021 22:37:13 -0700 Subject: [PATCH] compat nixpkgs and change to testing-python.nix --- lib/compat.nix | 17 +++++++++++++++++ modules/testing.nix | 2 +- release.nix | 26 ++++++++++++++++++-------- 3 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 lib/compat.nix diff --git a/lib/compat.nix b/lib/compat.nix new file mode 100644 index 0000000..01f0f02 --- /dev/null +++ b/lib/compat.nix @@ -0,0 +1,17 @@ +let + inherit (builtins) + fetchTarball + fromJSON + readFile + ; + lockfile = fromJSON (readFile ../flake.lock); +in +input: +let + locked = lockfile.nodes."${input}".locked; + inherit (locked) rev narHash owner repo; +in +fetchTarball { + url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; + sha256 = narHash; +} diff --git a/modules/testing.nix b/modules/testing.nix index a245122..65a14c2 100644 --- a/modules/testing.nix +++ b/modules/testing.nix @@ -7,7 +7,7 @@ let toJSONFile = content: builtins.toFile "json" (builtins.toJSON content); - nixosTesting = import "${nixosPath}/lib/testing.nix" { + nixosTesting = import "${nixosPath}/lib/testing-python.nix" { inherit pkgs; system = "x86_64-linux"; }; diff --git a/release.nix b/release.nix index 9353ca5..cdebf4b 100644 --- a/release.nix +++ b/release.nix @@ -1,5 +1,12 @@ -{ pkgs ? import {}, nixosPath ? toString , lib ? pkgs.lib -, e2e ? true, throwError ? true }: +let + fetch = import ./lib/compat.nix; +in +{ pkgs ? import (fetch "nixpkgs") { } +, nixosPath ? toString (fetch "nixpkgs") + "/nixos" +, lib ? pkgs.lib +, e2e ? true +, throwError ? true +}: with lib; @@ -23,7 +30,8 @@ let runK8STests = k8sVersion: import ./tests { inherit pkgs lib kubenix k8sVersion e2e throwError nixosPath; }; -in rec { +in +rec { generate.k8s = pkgs.linkFarm "k8s-generated.nix" [ { name = "v1.8.nix"; @@ -130,15 +138,17 @@ in rec { k8s-1_18 = runK8STests "1.18"; }; - test-results = pkgs.recurseIntoAttrs (mapAttrs (_: t: pkgs.recurseIntoAttrs { - results = pkgs.recurseIntoAttrs t.results; - result = t.result; - }) tests); + test-results = pkgs.recurseIntoAttrs (mapAttrs + (_: t: pkgs.recurseIntoAttrs { + results = pkgs.recurseIntoAttrs t.results; + result = t.result; + }) + tests); test-check = if !(all (test: test.success) (attrValues tests)) then throw "tests failed" else true; - examples = import ./examples {}; + examples = import ./examples { }; }