···2626 "unshareUser" "unshareCgroup" "unshareUts" "unshareNet" "unsharePid" "unshareIpc"
2727 ]);
28282929- etcBindFlags = let
2929+ etcBindEntries = let
3030 files = [
3131 # NixOS Compatibility
3232 "static"
···6969 "ca-certificates"
7070 "pki"
7171 ];
7272- in concatStringsSep "\n "
7373- (map (file: "--ro-bind-try $(${coreutils}/bin/readlink -m /etc/${file}) /etc/${file}") files);
7272+ in map (path: "/etc/${path}") files;
74737574 # Create this on the fly instead of linking from /nix
7675 # The container might have to modify it and re-run ldconfig if there are
···9998 '';
10099101100 bwrapCmd = { initArgs ? "" }: ''
102102- blacklist=(/nix /dev /proc /etc)
101101+ ignored=(/nix /dev /proc /etc)
103102 ro_mounts=()
104103 symlinks=()
104104+ etc_ignored=()
105105 for i in ${env}/*; do
106106 path="/''${i##*/}"
107107 if [[ $path == '/etc' ]]; then
108108 :
109109 elif [[ -L $i ]]; then
110110 symlinks+=(--symlink "$(${coreutils}/bin/readlink "$i")" "$path")
111111- blacklist+=("$path")
111111+ ignored+=("$path")
112112 else
113113 ro_mounts+=(--ro-bind "$i" "$path")
114114- blacklist+=("$path")
114114+ ignored+=("$path")
115115 fi
116116 done
117117···124124 continue
125125 fi
126126 ro_mounts+=(--ro-bind "$i" "/etc$path")
127127+ etc_ignored+=("/etc$path")
127128 done
128129 fi
129130131131+ for i in ${lib.escapeShellArgs etcBindEntries}; do
132132+ if [[ "''${etc_ignored[@]}" =~ "$i" ]]; then
133133+ continue
134134+ fi
135135+ if [[ -L $i ]]; then
136136+ symlinks+=(--symlink "$(${coreutils}/bin/readlink "$i")" "$i")
137137+ else
138138+ ro_mounts+=(--ro-bind-try "$i" "$i")
139139+ fi
140140+ done
141141+130142 declare -a auto_mounts
131143 # loop through all directories in the root
132144 for dir in /*; do
133133- # if it is a directory and it is not in the blacklist
134134- if [[ -d "$dir" ]] && [[ ! "''${blacklist[@]}" =~ "$dir" ]]; then
145145+ # if it is a directory and it is not ignored
146146+ if [[ -d "$dir" ]] && [[ ! "''${ignored[@]}" =~ "$dir" ]]; then
135147 # add it to the mount list
136148 auto_mounts+=(--bind "$dir" "$dir")
137149 fi
···179191 --symlink /etc/ld.so.cache ${pkgsi686Linux.glibc}/etc/ld.so.cache \
180192 --ro-bind ${pkgsi686Linux.glibc}/etc/rpc ${pkgsi686Linux.glibc}/etc/rpc \
181193 --remount-ro ${pkgsi686Linux.glibc}/etc \
182182- ${etcBindFlags}
183194 "''${ro_mounts[@]}"
184195 "''${symlinks[@]}"
185196 "''${auto_mounts[@]}"