mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-12 03:56:17 +03:00
build-fhs-{chroot,user}env: expose sockets in /tmp
This commit is contained in:
parent
ff25df9366
commit
ec27ba44d0
@ -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@/*
|
||||
|
@ -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
|
||||
|
@ -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}
|
||||
|
@ -7,6 +7,7 @@ mounts = [ ['/nix/store', nil],
|
||||
['/proc', nil],
|
||||
['/sys', nil],
|
||||
['/etc', 'host-etc'],
|
||||
['/tmp', 'host-tmp'],
|
||||
['/home', nil],
|
||||
['/var', nil],
|
||||
['/run', nil],
|
||||
|
@ -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}" "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user