diff --git a/hosts/patroclus/k3s.nix b/hosts/patroclus/k3s.nix index 143af9b..9c86238 100644 --- a/hosts/patroclus/k3s.nix +++ b/hosts/patroclus/k3s.nix @@ -1,4 +1,9 @@ -{ config, self, ... }: +{ + config, + self, + pkgs, + ... +}: { services.k3s = { enable = true; @@ -10,6 +15,37 @@ "--disable traefik" ]; }; + + environment.systemPackages = + let + inherit (pkgs) util-linux kubectl nfs-utils; + in + [ + kubectl + nfs-utils + # longhorn requires nsenter, this package provides it + util-linux + ]; + + # Link nix installed binaries to a path expected by longhorn. + # https://github.com/longhorn/longhorn/issues/2166 + # system.activationScripts.linkBinaries.text = '' + # mkdir -p /usr/local + # if [[ ! -h "/usr/local/bin" ]]; then + # ln -s /run/current-system/sw/bin /usr/local + # fi + # ''; + + # longhorn looks for nsenter in specific paths, /usr/local/bin is one of + # them so symlink the entire system/bin directory there. + # https://github.com/longhorn/longhorn/issues/2166#issuecomment-1864656450 + systemd.tmpfiles.rules = [ "L+ /usr/local/bin - - - - /run/current-system/sw/bin/" ]; + + services.openiscsi = { + enable = true; + name = "${config.networking.hostName}-initiatorhost"; + }; + users = { users.k3s = { isSystemUser = true;