Skip to content

Commit

Permalink
sandbox: add nix read-only mount if found
Browse files Browse the repository at this point in the history
  • Loading branch information
ahayzen committed Dec 1, 2024
1 parent 4b03bb9 commit e0e7603
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ PROJECT_FILES=(
"src/sandbox/input.sh"
"src/sandbox/kvm.sh"
"src/sandbox/name.sh"
"src/sandbox/nix.sh"
"src/sandbox/pipewire.sh"
"src/sandbox/pulseaudio.sh"
"src/sandbox/selinux.sh"
Expand Down
2 changes: 2 additions & 0 deletions src/sandbox/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ function sandbox_setup() {
sandbox_setup_input
printf "\r(%s) Finding KVM ... " "$TAG_NAME"
sandbox_setup_kvm
printf "\r(%s) Finding Nix ..." "$TAG_NAME"
sandbox_setup_nix
printf "\r(%s) Finding pipewire ... " "$TAG_NAME"
sandbox_setup_pipewire
printf "\r(%s) Finding pulseaudio ... " "$TAG_NAME"
Expand Down
13 changes: 13 additions & 0 deletions src/sandbox/nix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SPDX-FileCopyrightText: Andrew Hayzen <ahayzen@gmail.com>
#
# SPDX-License-Identifier: MPL-2.0

function sandbox_setup_nix() {
# If /nix exists then mount it in as our /home config could have symlinks
# into /nix folders and would fail otherwise
#
# We do not source any folders so the container environment is isolated
if [ -d /nix ]; then
CONTAINER_RUN_ARGS+=(--volume=/nix:/nix:ro)
fi
}

0 comments on commit e0e7603

Please sign in to comment.