Skip to content

Commit d05e528

Browse files
Lillecarlclaude
andcommitted
Migrate host mount path from /var/lib/nix-csi to /var/lib/nixkube
Update the default host mount path to use the new nixkube naming: - kubenix/options.nix: Change default hostMountPath to /var/lib/nixkube - src/constants.py: Update HOST_MOUNT_PATH default to /var/lib/nixkube - kubenix/daemonset.nix: Add /host volume mount to initContainer - liximage.nix: Update init-copy script to: - Always create /host/var/lib directory - Migrate legacy /host/var/lib/nix-csi to /host/var/lib/nixkube if present - Use /host/var/lib/nixkube as the nix store path - Store result in /host/var/lib/nixkube/nix/var/result This enables seamless migration from the old path while ensuring the new path is used for all future operations. All 38 tests passing, pyright 0 errors. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
1 parent 91755d0 commit d05e528

4 files changed

Lines changed: 14 additions & 7 deletions

File tree

kubenix/daemonset.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ in
7878
volumeMounts = lib.mkNamedList {
7979
nix-store.mountPath = "/nix-volume";
8080
nix-config.mountPath = "/etc/nix";
81-
81+
host-root.mountPath = "/host";
8282
ssh-config.mountPath = "/etc/ssh";
8383
ssh-key.mountPath = "/etc/ssh-key";
8484
ssh-dynauth.mountPath = "/etc/ssh-dynauth";

kubenix/options.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ in
6767
pyproject.project.version;
6868
};
6969
hostMountPath = lib.mkOption {
70-
description = "Where on the host to put nix-csi store, / is untested and not recommended";
70+
description = "Where on the host to put nixkube store, / is untested and not recommended";
7171
type = lib.types.path;
72-
default = "/var/lib/nix-csi";
72+
default = "/var/lib/nixkube";
7373
};
7474
internalServiceName = lib.mkOption {
7575
description = ''

liximage.nix

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ rec {
4545
mkdir /tmp
4646
rsync --archive ${fakeNss}/ /
4747
48+
# Ensure target directory exists and migrate legacy path if present
49+
mkdir -p /host/var/lib
50+
if [ -d /host/var/lib/nix-csi ]; then
51+
echo "Migrating /host/var/lib/nix-csi to /host/var/lib/nixkube"
52+
mv /host/var/lib/nix-csi /host/var/lib/nixkube
53+
fi
54+
4855
# Check if we can SSH to nix-cache
4956
EXTRA_SUBSTITUTERS="local?trusted=true"
5057
if nix store ping --store ssh-ng://nix@nix-cache; then
@@ -56,8 +63,8 @@ rec {
5663
--extra-substituters "$EXTRA_SUBSTITUTERS" \
5764
--max-jobs auto \
5865
--option sandbox false \
59-
--store /nix-volume \
60-
--out-link /nix-volume/nix/var/result \
66+
--store /host/var/lib/nixkube \
67+
--out-link /host/var/lib/nixkube/nix/var/result \
6168
--fallback \
6269
"''${!ARCH}"
6370
'';

pkgs/nixkube/src/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@
5656
NRI_PLUGIN_NAME = os.environ.get("NRI_PLUGIN_NAME", "nix-csi")
5757
NRI_PLUGIN_IDX = os.environ.get("NRI_PLUGIN_IDX", "00")
5858

59-
# NRI host mount path for bind mounts (default: /var/lib/nix-csi)
59+
# NRI host mount path for bind mounts (default: /var/lib/nixkube)
6060
# Set via HOST_MOUNT_PATH environment variable from kubenix
61-
HOST_MOUNT_PATH = Path(os.environ.get("HOST_MOUNT_PATH", "/var/lib/nix-csi"))
61+
HOST_MOUNT_PATH = Path(os.environ.get("HOST_MOUNT_PATH", "/var/lib/nixkube"))
6262

6363
# Statically linked chroot binary used to execute OCI hooks from HOST_MOUNT_PATH
6464
COREUTILS_STATIC = Path(os.environ.get("COREUTILS_STATIC", "coreutils"))

0 commit comments

Comments
 (0)