daemonix approach

This commit is contained in:
randogoth 2025-12-22 21:13:22 +02:00
parent 8d362d13b2
commit d4e84b0e41
7 changed files with 48 additions and 38 deletions

View file

@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail
mkdir -p /usr/share/nix-store /var/lib/nix-store /var/cache/nix-store /nix
# Skip if already mounted to avoid errors on reload.
if mountpoint -q /nix; then
exit 0
fi
mount -t overlay overlay \
-o lowerdir=/usr/share/nix-store,upperdir=/var/lib/nix-store,workdir=/var/cache/nix-store \
/nix

View file

@ -1,22 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
image_ref="${NIX_TOOLBOX_IMAGE:-ghcr.io/thrix/nix-toolbox:42}"
container_name="${NIX_TOOLBOX_CONTAINER:-nix-toolbox-42}"
if ! command -v toolbox >/dev/null 2>&1; then
echo "toolbox not installed; skipping nix-toolbox setup" >&2
exit 0
fi
if ! command -v podman >/dev/null 2>&1; then
echo "podman not installed; skipping nix-toolbox setup" >&2
exit 0
fi
if podman container exists "$container_name"; then
exit 0
fi
echo "Creating $container_name from $image_ref"
distrobox create --name "$container_name" --image "$image_ref"

View file

@ -0,0 +1,14 @@
[Unit]
Description=Mount OverlayFS for /nix
DefaultDependencies=no
After=local-fs.target
Before=nix-daemon.service
ConditionPathExists=/usr/bin/mount-nix-overlay.sh
[Service]
Type=oneshot
ExecStart=/usr/bin/mount-nix-overlay.sh
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View file

@ -1,14 +0,0 @@
[Unit]
Description=Ensure nix-toolbox container is available for this user
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
ExecStart=/usr/bin/nix-toolbox-ensure
RemainAfterExit=yes
Restart=on-failure
RestartSec=10
[Install]
WantedBy=default.target