hall / kubenix

Kubernetes management with Nix
https://kubenix.org/
MIT License
319 stars 30 forks source link

error: undefined variable 'system' when trying to initialise example with nix v2.21.0 #57

Closed adrian-gierakowski closed 8 months ago

adrian-gierakowski commented 8 months ago

steps to reproduce:

mkdir test
cd test
echo > '{
  inputs.kubenix.url = "github:hall/kubenix";
  outputs = {self, kubenix, ... }@inputs: let
    system = "x86_64-linux";
  in {
    packages.${system}.default = (kubenix.evalModules.${system} {
      module = { kubenix, ... }: {
        imports = [ kubenix.modules.k8s ];
        kubernetes.resources.pods.example.spec.containers.nginx.image = "nginx";
      };
    }).config.kubernetes.result;
  };
}' > flake.nix
git init
git add flake.nix
nix flake lock

results following error:

warning: Git tree '/code/kubenix-hall-test' is dirty
error:
       … while updating the lock file of flake 'git+file:///code/kubenix-hall-test'

       … while updating the flake input 'kubenix'

       error: undefined variable 'system'
       at /nix/store/q9f3b4mmzf33q1gmc5a3pqvg3g5hvpa8-source/flake.nix:62:36:
           61|         default = pkgs.callPackage ./pkgs/kubenix.nix {
           62|           inherit (self.packages.${system});
             |                                    ^
           63|           evalModules = self.evalModules.${pkgs.system};

which points at this line: https://github.com/hall/kubenix/blob/76b8053b27b062b11f0c9b495050cc55606ac9dc/flake.nix#L62

this like seems to not actually do anything and was previously ignored, however in latest version of nix this is an error