Skip to content

Instantly share code, notes, and snippets.

@peel
Last active November 20, 2018 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peel/4fa2111e782f9a417af16f513dca244d to your computer and use it in GitHub Desktop.
Save peel/4fa2111e782f9a417af16f513dca244d to your computer and use it in GitHub Desktop.
# nix-shell / nix run fails due to "unexpected end-of-file"
# it seems to be failing once starting up shell
bash-4.4$ nix-shell -p nix-info --run "nix-info -m"
these paths will be fetched (0.50 MiB download, 3.24 MiB unpacked):
/nix/store/1xa9zfa3l38wwb2q80wflqfdhsr0gsvd-bash-interactive-4.4-p23-doc
/nix/store/5c5gkamjgn6g4ya7pq7ly5h6240n8yzg-ed-1.14.2
/nix/store/6xvgmf7b38844my7jz34smw0mjkrmard-bash-interactive-4.4-p23-dev
/nix/store/84gsb3q644hwhp5ra15fb3x9669br9ib-patch-2.7.6
/nix/store/8qai18dv0nqyw6s61g9p91n8684rnlg8-stdenv-darwin
/nix/store/ddp58sracw2bipg75hj8d391rwmysrzx-adv_cmds-osx-10.5.8-locale
copying path '/nix/store/1xa9zfa3l38wwb2q80wflqfdhsr0gsvd-bash-interactive-4.4-p23-doc' from 'https://cache.nixos.org'...
copying path '/nix/store/ddp58sracw2bipg75hj8d391rwmysrzx-adv_cmds-osx-10.5.8-locale' from 'https://cache.nixos.org'...
copying path '/nix/store/6xvgmf7b38844my7jz34smw0mjkrmard-bash-interactive-4.4-p23-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/5c5gkamjgn6g4ya7pq7ly5h6240n8yzg-ed-1.14.2' from 'https://cache.nixos.org'...
error: unexpected end-of-file
# nix-info reports multi-user no, as `groups` does not show the `nixbld` group (is it a darwin thing?)
bash-4.4$ nix-info -m
- system: `"x86_64-darwin"`
- host os: `Darwin 18.2.0, macOS 10.14.1`
- multi-user?: `no`
- sandbox: `yes`
- version: `nix-env (Nix) 2.1.3`
- channels(root): `"nixpkgs-19.03pre158005.32340793aaf"`
- channels(peel): `"darwin, nixpkgs-19.03pre158005.32340793aaf"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
## CONFIG
bash-4.4$ cat /etc/profile
# System-wide .profile for sh(1)
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
if test -e /etc/bashrc; then . /etc/bashrc; fi
bash-4.4$ cat /etc/bashrc
if test -e /etc/static/bashrc; then . /etc/static/bashrc; fi
# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix
bash-4.4$ cat /etc/static/bashrc
# /etc/bashrc: DO NOT EDIT -- this file has been generated automatically.
# This file is read for interactive shells.
[ -r "/etc/bashrc_$TERM_PROGRAM" ] && . "/etc/bashrc_$TERM_PROGRAM"
# Only execute this file once per shell.
if [ -n "$__ETC_BASHRC_SOURCED" -o -n "$NOSYSBASHRC" ]; then return; fi
__ETC_BASHRC_SOURCED=1
# Don't execute this file when running in a pure nix-shell.
if test -n "$IN_NIX_SHELL"; then return; fi
if [ -z "$__NIX_DARWIN_SET_ENVIRONMENT_DONE" ]; then
. /nix/store/sbl60f02522rqiacsywj0m94hvzgln41-set-environment
fi
# Return early if not running interactively, but after basic nix setup.
[[ $- != *i* ]] && return
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Read system-wide modifications.
if test -f /etc/bash.local; then
source /etc/bash.local
fi
@jrolfs
Copy link

jrolfs commented Nov 20, 2018

Is this a solution to the error: unexpected end-of-file issue on Darwin? I'm sorry if I'm a bit clueless but I'm still very much a beginner as far as Nix goes and I've been struggling with this problem.

I've been running a multi-user install with no issues until coming across this cryptic error recently.

• nix-info -m                                                                           
 - system: `"x86_64-darwin"`
 - host os: `Darwin 18.2.0, macOS 10.14.2`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.1.3`
 - channels(root): `"nixpkgs-19.03pre159550.5ba0796bf2a"`
 - channels(jrolfs): `""`
 - nixpkgs: `/Users/jrolfs/.nix-defexpr/nixpkgs`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment