about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2015-08-24 01:42:40 +0300
committerNikolay Amiantov <ab@fmap.me>2015-08-24 01:47:19 +0300
commitec27ba44d0a39a25ada21e0eb6d480213823d6ff (patch)
treee8b263944f8602b64f33dc991bce588af2252d38 /pkgs/build-support
parentff25df9366c577f7bf6442aa3233f2ce81de5649 (diff)
downloadnixlib-ec27ba44d0a39a25ada21e0eb6d480213823d6ff.tar
nixlib-ec27ba44d0a39a25ada21e0eb6d480213823d6ff.tar.gz
nixlib-ec27ba44d0a39a25ada21e0eb6d480213823d6ff.tar.bz2
nixlib-ec27ba44d0a39a25ada21e0eb6d480213823d6ff.tar.lz
nixlib-ec27ba44d0a39a25ada21e0eb6d480213823d6ff.tar.xz
nixlib-ec27ba44d0a39a25ada21e0eb6d480213823d6ff.tar.zst
nixlib-ec27ba44d0a39a25ada21e0eb6d480213823d6ff.zip
build-fhs-{chroot,user}env: expose sockets in /tmp
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/build-fhs-chrootenv/init.sh.in2
-rw-r--r--pkgs/build-support/build-fhs-chrootenv/mount.sh.in8
-rw-r--r--pkgs/build-support/build-fhs-chrootenv/umount.sh.in2
-rwxr-xr-xpkgs/build-support/build-fhs-userenv/chroot-user.rb1
-rw-r--r--pkgs/build-support/build-fhs-userenv/default.nix5
5 files changed, 16 insertions, 2 deletions
diff --git a/pkgs/build-support/build-fhs-chrootenv/init.sh.in b/pkgs/build-support/build-fhs-chrootenv/init.sh.in
index 9078a31fe46a..9c85069a655c 100644
--- a/pkgs/build-support/build-fhs-chrootenv/init.sh.in
+++ b/pkgs/build-support/build-fhs-chrootenv/init.sh.in
@@ -3,7 +3,7 @@
 chrootenvDest=/run/chrootenv/@name@
 
 # Create some mount points for stuff that must be bind mounted
-mkdir -p $chrootenvDest/{nix/store,dev,proc,sys,host-etc,home,var,run}
+mkdir -p $chrootenvDest/{nix/store,dev,proc,sys,host-etc,host-tmp,home,var,run}
 
 # Symlink the software that should be part of the chroot system profile
 for i in @chrootEnv@/*
diff --git a/pkgs/build-support/build-fhs-chrootenv/mount.sh.in b/pkgs/build-support/build-fhs-chrootenv/mount.sh.in
index ef2cac21c21a..24b28aae78f7 100644
--- a/pkgs/build-support/build-fhs-chrootenv/mount.sh.in
+++ b/pkgs/build-support/build-fhs-chrootenv/mount.sh.in
@@ -22,5 +22,13 @@ mount --rbind /run $chrootenvDest/run
 # Bind mount the host system's /etc
 mount --bind /etc $chrootenvDest/host-etc
 
+# Bind mount the host system's /tmp
+mount --bind /tmp $chrootenvDest/host-tmp
+
 # Bind mount /tmp
 mount --bind /tmp/chrootenv-@name@ $chrootenvDest/tmp
+
+# Expose sockets in /tmp
+for i in /tmp/.*-unix; do
+  ln -s "/host-tmp/$(basename "$i")" "$chrootenvDest/$i"
+done
diff --git a/pkgs/build-support/build-fhs-chrootenv/umount.sh.in b/pkgs/build-support/build-fhs-chrootenv/umount.sh.in
index b8222a4121ab..27000cff10a9 100644
--- a/pkgs/build-support/build-fhs-chrootenv/umount.sh.in
+++ b/pkgs/build-support/build-fhs-chrootenv/umount.sh.in
@@ -3,4 +3,4 @@
 chrootenvDest=/run/chrootenv/@name@
 
 # Unmount all (r)bind mounts
-umount -l $chrootenvDest/{dev/pts,dev/shm,dev,nix/store,proc,sys,host-etc,home,var,tmp,run}
+umount -l $chrootenvDest/{dev/pts,dev/shm,dev,nix/store,proc,sys,host-etc,host-tmp,home,var,tmp,run}
diff --git a/pkgs/build-support/build-fhs-userenv/chroot-user.rb b/pkgs/build-support/build-fhs-userenv/chroot-user.rb
index c555f053875a..c31d0f7a2583 100755
--- a/pkgs/build-support/build-fhs-userenv/chroot-user.rb
+++ b/pkgs/build-support/build-fhs-userenv/chroot-user.rb
@@ -7,6 +7,7 @@ mounts = [ ['/nix/store', nil],
            ['/proc', nil],
            ['/sys', nil],
            ['/etc', 'host-etc'],
+           ['/tmp', 'host-tmp'],
            ['/home', nil],
            ['/var', nil],
            ['/run', nil],
diff --git a/pkgs/build-support/build-fhs-userenv/default.nix b/pkgs/build-support/build-fhs-userenv/default.nix
index 546345c7e6c2..b5b77f9984a5 100644
--- a/pkgs/build-support/build-fhs-userenv/default.nix
+++ b/pkgs/build-support/build-fhs-userenv/default.nix
@@ -10,6 +10,11 @@ let
   '';
 
   init = writeText "init" ''
+           # Expose sockets in /tmp
+           for i in /host-tmp/.*-unix; do
+             ln -s "$i" "/tmp/$(basename "$i")"
+           done
+
            [ -d "$1" ] && [ -r "$1" ] && cd "$1"
            shift
            exec "${runScript}" "$@"