@@ -112,7 +112,6 @@ int main(int argc, char *argv[]) {
112 switch (opt) {
112 switch (opt) {
113 case 'c':
113 case 'c':
114 clear_env = 1;
114 clear_env = 1;
115− puts("clearing env");
117 case 'n':
116 case 'n':
118 // determine absolute directory for nix dir
117 // determine absolute directory for nix dir
@@ -167,7 +166,12 @@ int main(int argc, char *argv[]) {
168 // "unshare" into new namespace
167 // "unshare" into new namespace
169 if (unshare(CLONE_NEWNS | CLONE_NEWUSER) < 0) {
168 if (unshare(CLONE_NEWNS | CLONE_NEWUSER) < 0) {
169+ if (errno == EPERM) {
170+ fputs("Run the following as root to enable unprivileged namespace use:\nsysctl -w kernel.unprivileged_userns_clone=1 ; echo kernel.unprivileged_userns_clone=1 > /etc/sysctl.d/nix-user-chroot.conf\n\n", stderr);
170− err_exit("unshare()");
173+ err_exit("unshare()");
173 // add necessary system stuff to rootdir namespace
177 // add necessary system stuff to rootdir namespace