added nix toolbox
This commit is contained in:
parent
df6bc8c3b4
commit
2ac7aebcb0
3 changed files with 41 additions and 0 deletions
22
files/system/usr/bin/nix-toolbox-ensure
Executable file
22
files/system/usr/bin/nix-toolbox-ensure
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/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"
|
||||
toolbox create --container "$container_name" --image "$image_ref"
|
||||
14
files/system/usr/lib/systemd/user/nix-toolbox-create.service
Normal file
14
files/system/usr/lib/systemd/user/nix-toolbox-create.service
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[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
|
||||
|
|
@ -17,6 +17,11 @@ modules:
|
|||
- source: system
|
||||
destination: / # copies files/system/* (* means everything inside it) into your image's root folder /
|
||||
|
||||
- type: systemd
|
||||
user:
|
||||
enabled:
|
||||
- nix-toolbox-create.service
|
||||
|
||||
- type: dnf
|
||||
install:
|
||||
packages:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue