Compare commits

..
Author SHA1 Message Date
Eelco Dolstra 33d58a1904 Bump version 2017-12-12 17:48:02 +01:00
Eelco Dolstra c6e15c4322 Disable shellcheck
This breaks eval on aarch64-linux due to the dependency on GHC.
2017-12-12 15:33:53 +01:00
Eelco Dolstra 7487debaf5 Merge pull request #1700 from grahamc/fixup-darwin-hs
darwin installer: fix on High Sierra
2017-12-12 11:51:14 +01:00
Eelco Dolstra a18c085af8 Merge pull request #1716 from grahamc/build-1.11-on-aarch
Build 1.11 on aarch64-linux
2017-12-08 14:00:21 +01:00
Graham Christensen 6b887844d6 replace lolcat with nix-info
(cherry picked from commit 1db034364a)
2017-12-08 07:30:51 -05:00
Graham Christensen c32bdf0548 darwin installer: fix on High Sierra
(cherry picked from commit be79d1f189)
2017-12-08 07:30:44 -05:00
Eelco Dolstra e462fa746b Build on aarch64-linux
(cherry picked from commit da76c72bc9)
2017-12-07 17:22:28 -05:00
Eelco Dolstra 3454356001 Merge pull request #1648 from danbst/patch-1
nix-collect-garbage: little doc fix
2017-11-03 10:51:16 +01:00
Danylo Hlynskyi c7c806ec21 nix-collect-garbage: little doc fix
This removes confusing documentation. It's better to remove doc than add implementation, because Nix 1.12 will surely have new GC interface anyway.

Fixes https://github.com/NixOS/nix/issues/641
2017-10-31 05:12:08 +02:00
Eelco Dolstra 76431e0a26 nix-shell -p: Use runCommandCC
This restores pre-17.03 behaviour by making gcc available.

(Ported from 9b63bb88c8)
2017-10-13 17:28:04 +02:00
Shea Levy 3c52567b3e darwin installer: Fix on systems where sudo -i is disabled.
(cherry picked from commit fb98e29067)
2017-10-12 13:08:33 +02:00
Anthony Cowley b03066835c install-darwin-multi-user: relax assumption check
The installer will error out if a user's shell configuration includes any mention of ~nix-profile~, even if this is in a comment. This change is designed to do the bare minimum to ignore lines beginning with a `#`.

(cherry picked from commit 92f9d18aa0)
2017-10-12 13:06:46 +02:00
Eelco Dolstra aa57c32318 Bump version 2017-09-15 16:40:20 +02:00
Eelco Dolstra f217acd9e7 Merge pull request #1566 from FPtje/1.11-maintenance
scripts/nix-copy-closure.in: Automatically flush STDERR handle
2017-09-10 17:51:31 +02:00
Falco Peijnenburg b3ad7c5052 scripts/nix-copy-closure.in: Automatically flush STDERR handle
Fixes https://github.com/NixOS/nixops/issues/455
2017-09-10 17:38:18 +02:00
Eelco Dolstra e8235c4f3e Bump version 2017-09-01 11:13:16 +02:00
Sergei Trofimovich 41352d50db src/libmain/stack.cc: fix 'ucontext' usage on glibc-2.26
Build fails as:

$ make
  CXX    src/libmain/stack.o
src/libmain/stack.cc: In function 'void nix::sigsegvHandler(int, siginfo_t*, void*)':
src/libmain/stack.cc:21:21: error: 'ucontext' was not declared in this scope
     sp = (char *) ((ucontext *) ctx)->uc_mcontext.gregs[REG_RSP];
                     ^~~~~~~~
src/libmain/stack.cc:21:21: note: suggested alternative: 'ucontext_t'
     sp = (char *) ((ucontext *) ctx)->uc_mcontext.gregs[REG_RSP];
                     ^~~~~~~~
                     ucontext_t

It's caused by upstream rename:
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=251287734e89a52da3db682a8241eb6bccc050c9

which basically changes
    typedef struct ucontext {} ucontext_t;
to
    typedef struct ucontext_t {} ucontext_t;

The change uses ucontext_t.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
(cherry picked from commit c9857ef262)
2017-09-01 11:12:49 +02:00
Eelco Dolstra b3a616e860 Bump version 2017-08-30 20:03:33 +02:00
Eelco Dolstra 617dab1515 Merge pull request #1543 from matthewbauer/1.11-maintenance
OS X sandbox: Store .sb file in $TMPDIR rather than the Nix store
2017-08-30 19:50:40 +02:00
Eelco Dolstra 35f541a7a0 OS X sandbox: Store .sb file in $TMPDIR rather than the Nix store
The filename used was not unique and owned by the build user, so
builds could fail with

error: while setting up the build environment: cannot unlink ‘/nix/store/99i210ihnsjacajaw8r33fmgjvzpg6nr-bison-3.0.4.drv.sb’: Permission denied
2017-08-30 12:06:31 -05:00
Eelco Dolstra 23795d47fb Merge pull request #1540 from grahamc/test-o
1.11: Replace stat / uid comparison with test -O
2017-08-30 15:43:47 +02:00
Graham Christensen d07697de5f Replace stat / uid comparison with test -O 2017-08-29 18:56:32 -04:00
Domen Kožar 3afb744185 Merge pull request #1313 from neilmayhew/topic/cores
Propagate NIX_BUILD_CORES to nix-shell environments
2017-08-02 15:02:25 +02:00
Eelco Dolstra 04532ee2c8 Fix test failure
(cherry picked from commit 46e36f9b73)
Signed-off-by: Domen Kožar <domen@dev.si>
2017-07-25 11:50:31 +02:00
Eelco Dolstra 24883645a6 Merge pull request #1486 from grahamc/detect-already-running
Test to see if nix-daemon is running already
2017-07-25 09:24:06 +02:00
Graham Christensen 9a04bc6f5e Test to see if nix-daemon is running already
A user had an install, uninstalled it via the instructions, and found their nix broken.

The issue was based around nix-daemon already running.

I tried to be very smart around searching their launchctl files:

  $ grep -ri nix-daemon  ~/Library/LaunchAgents /Library/LaunchAgents /Library/LaunchDaemons /System/Library/LaunchAgents /System/Library/LaunchDaemons

but then couldn't figure out how to write out (nicely) commands for uninstalling
or unloading them based on their name, and also couching the instrunctions in a
bit of doubt so we don't piss off some poor mac admin because their users just
deleted some important launchd files.
2017-07-24 22:37:22 -04:00
Eelco Dolstra 0ec723375b Merge pull request #1469 from grahamc/domen-feedback-nix
Show users how to source the profile, to get a working Nix.
2017-07-17 15:05:17 +02:00
Graham Christensen 4b45f94b5c Show users how to source the profile, to get a working Nix. 2017-07-17 08:39:14 -04:00
Eelco Dolstra 16daed49dc Merge pull request #1463 from grahamc/fix-stdin-errors
Fix stdin errors
2017-07-14 15:07:57 +02:00
Graham Christensen 41f0a08a31 bump version to 1.11.13 2017-07-14 06:28:47 -04:00
Graham Christensen e4831a4412 Rename PINCH_ME_IM_SILLY to ALLOW_PREEXISTING_INSTALLATION 2017-07-14 06:28:24 -04:00
Graham Christensen 6ba624f25a If there is no TTY, also skip verbose sudo messages 2017-07-14 06:23:51 -04:00
Graham Christensen 6b6d4b69c1 Ensure PINCH_ME_IM_SILLY allows a /nix/store to stick around between builds
Also output in the status report that the user is very silly
2017-07-13 19:45:00 -04:00
Graham Christensen b01eaa6114 Assume yes if we have no TTY
Starve the TTY of input to ensure this works, but provide yes to the
current installer to handle the current broken case.
2017-07-13 18:03:53 -04:00
Neil Mayhew de4e706776 Propagate NIX_BUILD_CORES to nix-shell environments 2017-04-08 21:31:44 -06:00
11 changed files with 123 additions and 47 deletions

No files matched your search

@@ -22,12 +22,6 @@
<arg><option>--delete-old</option></arg>
<arg><option>-d</option></arg>
<arg><option>--delete-older-than</option> <replaceable>period</replaceable></arg>
<group choice='opt'>
<arg choice='plain'><option>--print-roots</option></arg>
<arg choice='plain'><option>--print-live</option></arg>
<arg choice='plain'><option>--print-dead</option></arg>
<arg choice='plain'><option>--delete</option></arg>
</group>
<arg><option>--max-freed</option> <replaceable>bytes</replaceable></arg>
<arg><option>--dry-run</option></arg>
</cmdsynopsis>
+4 -4
View File
@@ -7,7 +7,7 @@ let
pkgs = import <nixpkgs> {};
systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" /* "x86_64-freebsd" "i686-freebsd" */ ];
systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" /* "x86_64-freebsd" "i686-freebsd" */ ];
jobs = rec {
@@ -123,7 +123,7 @@ let
runCommand "nix-binary-tarball-${version}"
{ exportReferencesGraph = [ "closure1" toplevel "closure2" cacert ];
buildInputs = [ perl shellcheck ];
buildInputs = [ perl /* shellcheck */ ];
meta.description = "Distribution-independent Nix bootstrap binaries for ${system}";
}
''
@@ -136,8 +136,8 @@ let
--subst-var-by nix ${toplevel} \
--subst-var-by cacert ${cacert}
shellcheck -e SC1090 $TMPDIR/install
shellcheck -e SC1091,SC2002 $TMPDIR/install-darwin-multi-user
#shellcheck -e SC1090 $TMPDIR/install
#shellcheck -e SC1091,SC2002 $TMPDIR/install-darwin-multi-user
chmod +x $TMPDIR/install
chmod +x $TMPDIR/install-darwin-multi-user
+92 -21
View File
@@ -43,6 +43,20 @@ readonly EXTRACTED_NIX_PATH="$(dirname "$0")"
readonly ROOT_HOME="/var/root"
if [ -t 0 ]; then
readonly IS_HEADLESS='no'
else
readonly IS_HEADLESS='yes'
fi
headless() {
if [ "$IS_HEADLESS" = "yes" ]; then
return 0
else
return 1
fi
}
contactme() {
echo "We'd love to help if you need it."
echo ""
@@ -173,6 +187,11 @@ failure() {
ui_confirm() {
_textout "$GREEN$GREEN_UL" "$1"
if headless; then
echo "No TTY, assuming you would say yes :)"
return 0
fi
local prompt="[y/n] "
echo -n "$prompt"
while read -r y; do
@@ -210,9 +229,10 @@ __sudo() {
_sudo() {
local expl="$1"
shift
if __sudo "$expl" "$*"; then
sudo "$@"
if ! headless; then
__sudo "$expl" "$*"
fi
sudo "$@"
}
@@ -239,12 +259,17 @@ function finish_success {
ok "Alright! We're done!"
cat <<EOF
Before Nix will work in your existing shells, you'll need to close
them and open them again. Other than that, you should be ready to go.
Before Nix will work in your existing shells, you'll need to either
run:
$ source $PROFILE_NIX_FILE
or close them and open them again. Other than that, you should be
ready to go.
Try it! Open a new terminal, and type:
$ nix-shell -p figlet -p lolcat --run "echo 'nix rules' | figlet | lolcat"
$ nix-shell -p nix-info --run "nix-info -m"
Thank you for using this installer. If you have any feedback, don't
hesitate:
@@ -271,6 +296,19 @@ EOF
Nix already appears to be installed, and this tool assumes it is
_not_ yet installed.
$(uninstall_directions)
EOF
fi
if pgrep nix-daemon 2> /dev/null >&2; then
failure <<EOF
Nix seems to be partially installed, because the nix-daemon is
currently running. It may be in a launchd service. Please stop the
the old nix-daemon, and try again.
If you have an existing launchd plist for nix-daemon, please delete
it.
$(uninstall_directions)
EOF
fi
@@ -298,7 +336,7 @@ EOF
for file in ~/.bash_profile ~/.bash_login ~/.profile ~/.zshenv ~/.zprofile ~/.zshrc ~/.zlogin; do
if [ -f "$file" ]; then
if grep -l ".nix-profile" "$file"; then
if grep -l "^[^#].*.nix-profile" "$file"; then
failure <<EOF
I found a reference to a ".nix-profile" in $file.
This has a high chance of breaking a new nix installation. It was most
@@ -397,6 +435,9 @@ setup_report() {
row " Build Users" "$NIX_USER_COUNT"
row " Build Group ID" "$NIX_BUILD_GROUP_ID"
row "Build Group Name" "$NIX_BUILD_GROUP_NAME"
if [ "${ALLOW_PREEXISTING_INSTALLATION:-}" != "" ]; then
row "Preexisting Install" "Allowed"
fi
subheader "build users:"
@@ -450,10 +491,8 @@ create_build_user_for_core() {
if ! /usr/bin/dscl . -read "$dsclpath" > /dev/null 2>&1; then
_sudo "Creating the Nix build user, $username" \
/usr/sbin/sysadminctl -addUser -fullName "Nix build user $coreid" \
-home /var/empty \
-UID "${uid}" \
-addUser "${username}"
/usr/bin/dscl . create "$dsclpath" \
UniqueID "${uid}"
row " Created" "Yes"
else
actual_uid=$(dsclattr "$dsclpath" "UniqueID")
@@ -481,6 +520,22 @@ EOF
row " IsHidden" "Yes"
fi
if [ "$(dsclattr "$dsclpath" "NFSHomeDirectory")" = "/var/empty" ]; then
row " NFSHomeDirectory" "/var/empty"
else
_sudo "in order to give $username a safe home directory" \
/usr/bin/dscl . -create "$dsclpath" "NFSHomeDirectory" "/var/empty"
row " NFSHomeDirectory" "/var/empty"
fi
if [ "$(dsclattr "$dsclpath" "RealName")" = "Nix build user $coreid" ]; then
row " RealName" "Nix build user $coreid"
else
_sudo "in order to give $username a useful name" \
/usr/bin/dscl . -create "$dsclpath" "RealName" "Nix build user $coreid"
row " RealName" "Nix build user $coreid"
fi
if [ "$(dsclattr "$dsclpath" "UserShell")" = "/sbin/nologin" ]; then
row " Logins Disabled" "Yes"
else
@@ -498,11 +553,11 @@ EOF
row " Member of $NIX_BUILD_GROUP_NAME" "Yes"
fi
if [ "$(dsclattr "$dsclpath" "PrimaryGroupId")" = "$NIX_BUILD_GROUP_ID" ]; then
if [ "$(dsclattr "$dsclpath" "PrimaryGroupID")" = "$NIX_BUILD_GROUP_ID" ]; then
row " PrimaryGroupID" "$NIX_BUILD_GROUP_ID"
else
_sudo "to let the nix daemon use this user for builds (this might seem redundant, but there are two concepts of group membership)" \
/usr/bin/dscl . -create "$dsclpath" "PrimaryGroupId" "$NIX_BUILD_GROUP_ID"
/usr/bin/dscl . -create "$dsclpath" "PrimaryGroupID" "$NIX_BUILD_GROUP_ID"
row " PrimaryGroupID" "$NIX_BUILD_GROUP_ID"
fi
@@ -606,6 +661,27 @@ EOF
chat_about_sudo() {
header "let's talk about sudo"
if headless; then
cat <<EOF
This script is going to call sudo a lot. Normally, it would show you
exactly what commands it is running and why. However, the script is
run in a headless fashion, like this:
$ curl https://nixos.org/nix/install | sh
or maybe in a CI pipeline. Because of that, we're going to skip the
verbose output in the interest of brevity.
If you would like to
see the output, try like this:
$ curl -o install-nix https://nixos.org/nix/install
$ sh ./install-nix
EOF
return 0
fi
cat <<EOF
This script is going to call sudo a lot. Every time we do, it'll
output exactly what it'll do, and why.
@@ -686,13 +762,13 @@ configure_shell_profile() {
setup_default_profile() {
_sudo "to installing a bootstrapping Nix in to the default Profile" \
-i "$NIX_INSTALLED_NIX/bin/nix-env" -i "$NIX_INSTALLED_NIX"
HOME=$ROOT_HOME "$NIX_INSTALLED_NIX/bin/nix-env" -i "$NIX_INSTALLED_NIX"
_sudo "to installing a bootstrapping SSL certificate just for Nix in to the default Profile" \
-i "$NIX_INSTALLED_NIX/bin/nix-env" -i "$NIX_INSTALLED_CACERT"
HOME=$ROOT_HOME "$NIX_INSTALLED_NIX/bin/nix-env" -i "$NIX_INSTALLED_CACERT"
_sudo "to update the default channel in the default profile" \
-i NIX_SSL_CERT_FILE=/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt "$NIX_INSTALLED_NIX/bin/nix-channel" --update nixpkgs
HOME=$ROOT_HOME NIX_SSL_CERT_FILE=/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt "$NIX_INSTALLED_NIX/bin/nix-channel" --update nixpkgs
}
@@ -733,7 +809,7 @@ main() {
welcome_to_nix
chat_about_sudo
if [ "${PINCH_ME_IM_SILLY:-}" = "" ]; then
if [ "${ALLOW_PREEXISTING_INSTALLATION:-}" = "" ]; then
validate_starting_assumptions
fi
@@ -746,11 +822,6 @@ main() {
exit 1
fi
if [ "${PINCH_ME_IM_SILLY:-}" != "" ]; then
exit 1
fi
create_build_group
create_build_users
create_directories
+6 -1
View File
@@ -11,6 +11,8 @@ use Cwd;
binmode STDERR, ":encoding(utf8)";
Nix::Config::readConfig;
my $dryRun = 0;
my $verbose = 0;
my $runEnv = $0 =~ /nix-shell$/;
@@ -224,7 +226,7 @@ die "$0: ‘-p’ and ‘-E’ are mutually exclusive\n" if $packages && $fromAr
if ($packages) {
push @instArgs, "--expr";
@exprs = (
'with import <nixpkgs> { }; runCommand "shell" { buildInputs = [ '
'with import <nixpkgs> { }; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ '
. (join " ", map { "($_)" } @exprs) . ']; } ""');
} elsif (!$fromArgs) {
@exprs = ("shell.nix") if scalar @exprs == 0 && $runEnv && -e "shell.nix";
@@ -279,6 +281,9 @@ foreach my $expr (@exprs) {
}
$ENV{'NIX_BUILD_TOP'} = $ENV{'TMPDIR'} = $ENV{'TEMPDIR'} = $ENV{'TMP'} = $ENV{'TEMP'} = $tmp;
$ENV{'NIX_STORE'} = $Nix::Config::storeDir;
if (defined $Nix::Config::config{"build-cores"}) {
$ENV{'NIX_BUILD_CORES'} = $Nix::Config::config{"build-cores"};
}
$ENV{$_} = $drv->{env}->{$_} foreach keys %{$drv->{env}};
# Run a shell using the derivation's environment. For
+2
View File
@@ -7,8 +7,10 @@ use Nix::Config;
use Nix::Store;
use Nix::CopyClosure;
use List::Util qw(sum);
use IO::Handle;
binmode STDERR, ":encoding(utf8)";
STDERR->autoflush(1);
if (scalar @ARGV < 1) {
print STDERR <<EOF
+2 -2
View File
@@ -13,7 +13,7 @@ export NIX_PROFILES="@localstatedir@/nix/profiles/default $HOME/.nix-profile"
# Set up the per-user profile.
mkdir -m 0755 -p $NIX_USER_PROFILE_DIR
if test "$(stat -f '%u' $NIX_USER_PROFILE_DIR)" != "$(id -u)"; then
if ! test -O "$NIX_USER_PROFILE_DIR"; then
echo "WARNING: bad ownership on $NIX_USER_PROFILE_DIR" >&2
fi
@@ -35,7 +35,7 @@ if test -w $HOME; then
# Create the per-user garbage collector roots directory.
NIX_USER_GCROOTS_DIR=@localstatedir@/nix/gcroots/per-user/$USER
mkdir -m 0755 -p $NIX_USER_GCROOTS_DIR
if test "$(stat -f '%u' $NIX_USER_GCROOTS_DIR)" != "$(id -u)"; then
if ! test -O "$NIX_USER_GCROOTS_DIR"; then
echo "WARNING: bad ownership on $NIX_USER_GCROOTS_DIR" >&2
fi
+2 -2
View File
@@ -20,9 +20,9 @@ static void sigsegvHandler(int signo, siginfo_t * info, void * ctx)
bool haveSP = true;
char * sp = 0;
#if defined(__x86_64__) && defined(REG_RSP)
sp = (char *) ((ucontext *) ctx)->uc_mcontext.gregs[REG_RSP];
sp = (char *) ((ucontext_t *) ctx)->uc_mcontext.gregs[REG_RSP];
#elif defined(REG_ESP)
sp = (char *) ((ucontext *) ctx)->uc_mcontext.gregs[REG_ESP];
sp = (char *) ((ucontext_t *) ctx)->uc_mcontext.gregs[REG_ESP];
#else
haveSP = false;
#endif
+1 -4
View File
@@ -778,7 +778,6 @@ private:
#if __APPLE__
typedef string SandboxProfile;
SandboxProfile additionalSandboxProfile;
AutoDelete autoDelSandbox;
#endif
/* Hash rewriting. */
@@ -2633,9 +2632,7 @@ void DerivationGoal::runChild()
debug("Generated sandbox profile:");
debug(sandboxProfile);
Path sandboxFile = drvPath + ".sb";
if (pathExists(sandboxFile)) deletePath(sandboxFile);
autoDelSandbox.reset(sandboxFile, false);
Path sandboxFile = tmpDir + "/.sandbox.sb";
writeFile(sandboxFile, sandboxProfile);
+10 -3
View File
@@ -53,7 +53,8 @@ trap finish EXIT
# First setup Nix
cleanup
curl https://nixos.org/nix/install | bash
curl -o install https://nixos.org/nix/install
yes | bash ./install
verify
@@ -79,11 +80,17 @@ verify
yes | ./install
verify
cleanup
yes | ./install
echo -n "" | ./install
verify
cleanup
sudo mkdir -p /nix/store
sudo touch /nix/store/.silly-hint
echo -n "" | ALLOW_PREEXISTING_INSTALLATION=true ./install
verify
test -e /nix/store/.silly-hint
cleanup
)
+3 -3
View File
@@ -16,11 +16,11 @@ tarball=$TEST_ROOT/tarball.tar.xz
nix-env -f file://$tarball -qa --out-path | grep -q dependencies
nix-build file://$tarball
nix-build -o $TEST_ROOT/result file://$tarball
nix-build '<foo>' -I foo=file://$tarball
nix-build -o $TEST_ROOT/result '<foo>' -I foo=file://$tarball
nix-build -o $TMPDIR/result -E "import (fetchTarball file://$tarball)"
nix-build -o $TEST_ROOT/result -E "import (fetchTarball file://$tarball)"
nix-instantiate --eval -E '1 + 2' -I fnord=file://no-such-tarball.tar.xz
nix-instantiate --eval -E 'with <fnord/xyzzy>; 1 + 2' -I fnord=file://no-such-tarball.tar.xz
+1 -1
View File
@@ -1 +1 @@
1.11.12
1.11.17