pass nixos path explicitly

This commit is contained in:
Jaka Hudoklin 2019-05-03 23:25:49 +02:00
parent 7b148cd171
commit e4493addd8
No known key found for this signature in database
GPG key ID: 916062A1C4748647
4 changed files with 15 additions and 9 deletions

8
ci.nix
View file

@ -1,7 +1,11 @@
let
pkgs = import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz") {};
nixpkgsSrc = builtins.fetchTarball "https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz";
pkgs = import nixpkgsSrc {};
lib = pkgs.lib;
release = import ./release.nix { inherit pkgs lib; };
release = import ./release.nix {
inherit pkgs lib;
nixosPath = "${nixpkgsSrc}/nixos";
};
in with lib; release.test-results

View file

@ -1,16 +1,16 @@
{ config, pkgs, lib, kubenix, ... }:
{ nixosPath, config, pkgs, lib, kubenix, ... }:
with lib;
let
cfg = config.testing;
nixosTesting = import <nixpkgs/nixos/lib/testing.nix> {
nixosTesting = import "${nixosPath}/lib/testing.nix" {
inherit pkgs;
system = "x86_64-linux";
};
kubernetesBaseConfig = { config, pkgs, lib, nodes, ... }: let
kubernetesBaseConfig = { modulesPath, config, pkgs, lib, nodes, ... }: let
master = findFirst
(node: any (role: role == "master") node.config.services.kubernetes.roles)
(throw "no master node")
@ -23,7 +23,7 @@ let
(attrValues nodes)}
'';
in {
imports = [ <nixpkgs/nixos/modules/profiles/minimal.nix> ];
imports = [ "${toString modulesPath}/profiles/minimal.nix" ];
config = mkMerge [{
boot.postBootCommands = "rm -fr /var/lib/kubernetes/secrets /tmp/shared/*";

View file

@ -1,4 +1,5 @@
{ pkgs ? import <nixpkgs> {}, lib ? pkgs.lib, e2e ? true, throwError ? true }:
{ pkgs ? import <nixpkgs> {}, nixosPath ? <nixpkgs/nixos>, lib ? pkgs.lib
, e2e ? true, throwError ? true }:
with lib;
@ -19,7 +20,7 @@ let
};
runK8STests = k8sVersion: pkgs.recurseIntoAttrs (import ./tests {
inherit pkgs lib kubenix k8sVersion e2e throwError;
inherit pkgs lib kubenix k8sVersion e2e throwError nixosPath;
});
in rec {
generate.k8s = pkgs.linkFarm "k8s-generated.nix" [{

View file

@ -2,6 +2,7 @@
, lib ? pkgs.lib
, kubenix ? import ../. { inherit pkgs lib; }
, k8sVersion ? "1.13"
, nixosPath ? <nixpkgs/nixos>
# whether any testing error should throw an error
, throwError ? true
@ -43,7 +44,7 @@ let
inherit pkgs;
};
specialArgs = {
inherit kubenix;
inherit kubenix nixosPath;
};
}).config;
in test.testing