Skip to content

Commit

Permalink
feat: add openiscsi for longhorn support
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaxbits committed Jan 3, 2025
1 parent 0188920 commit b90d71d
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion hosts/patroclus/k3s.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ config, self, ... }:
{
config,
self,
pkgs,
...
}:
{
services.k3s = {
enable = true;
Expand All @@ -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;
Expand Down

0 comments on commit b90d71d

Please sign in to comment.