Stuck on bug while trying to install Kubernetes

Hello folks,
I’m trying to install Kubernetes using the unstable channel, but right now it’s broken - before noticing that thread I even opened a bug report.

Following this question, I tried to install the stable version of Kubernetes, installed the stable channel with the alias nixos-19.03, still failed with:

error: file ‘nixos-19.03/nixos/modules/services/cluster/kubernetes.nix’ was not found in the Nix search path (add it using $NIX_PATH or -I), at /etc/nixos/configuration.nix

{ config, pkgs, ... }:

let
  baseconfig = { allowUnfree = true; };
  stable = import <nixos-19.03> { config = baseconfig; };
in
{
  imports =
    [
      <nixos-19.03/nixos/modules/services/cluster/kubernetes.nix>
    ];

  disabledModules = [ "services/cluster/kubernetes.nix" ];
  nixpkgs.config = baseconfig // {
    packageOverrides = pkgs: {
      kubernetes = stable.kubernetes;
    }; 
  };

  services.kubernetes = {
   roles = ["master" "node"];
   addons.dashboard.enable = true;
   masterAddress = "localhost";
  };

  virtualisation.docker.enable = true;
  virtualisation.docker.enableOnBoot = true;

  system.stateVersion = "19.03";
}

Technical details

sudo nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 4.19.52, NixOS, 19.09pre183392.83ba5afcc96 (Loris)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.2.2`
 - channels(root): `"nixos-19.09pre183392.83ba5afcc96"`
 - channels(ebonetti): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Channels

sudo nix-channel --list
nixos https://nixos.org/channels/nixos-unstable
nixos-19.03 https://nixos.org/channels/nixos-19.03

Can somebody show me the way, pretty please?
Enrico Bonetti Vieno

The bug here is your supposition that there is a direct connection between the named entries in nix-channel and the paths using angular brackets: there is none.

See the doc in nix manual about those paths, and valid usage example.

Real problem here is that I’m a nix newbie :sweat_smile: … so the manual reference is very welcome, thanks for pointing out!

Now the configuration looks something like this: I used the allowUnsupportedSystem flag to work around the error: Package ‘kubectl-1.13.7’ ... is not supported on ‘x86_64-linux’, refusing to evaluate.
So now nixos-rebuild switch completes, but it’s stuck on restarting the services.

{ config, pkgs, ... }:

let
  baseconfig = { allowUnfree = true; allowUnsupportedSystem = true; };
  stable = import (
     fetchTarball channel:nixos-19.03
   ) { config = baseconfig; };
in
{
  imports =
    [
      "${stable.path}/nixos/modules/services/cluster/kubernetes/default.nix"
    ];

  disabledModules = [ "services/cluster/kubernetes/default.nix" ];
  nixpkgs.config = baseconfig // {
    packageOverrides = pkgs: {
      kubernetes = stable.kubernetes;
    }; 
  };

  services.kubernetes = {
   roles = ["master" "node"];
   addons.dashboard.enable = true;
   masterAddress = "localhost";
  };

  virtualisation.docker.enable = true;
  virtualisation.docker.enableOnBoot = true;

  system.stateVersion = "19.03";
}

Enrico