Commit Graph

7175 Commits

Author SHA1 Message Date
John Ericson
d2008f2fff
unbreak build without pch
(cherry picked from commit d64ab5131c)
2020-06-02 23:09:19 +02:00
Eelco Dolstra
734488a00f
Merge pull request #3646 from NixOS/2.3-wsl
Disable use-sqlite-wal under WSL
2020-06-01 19:49:20 +02:00
Brian McKenna
35f5da530a
Disable use-sqlite-wal under WSL
Before:

    $ nix-channel --update
    unpacking channels...
    warning: SQLite database '/nix/var/nix/db/db.sqlite' is busy (SQLITE_PROTOCOL)
    warning: SQLite database '/nix/var/nix/db/db.sqlite' is busy (SQLITE_PROTOCOL)
    warning: SQLite database '/nix/var/nix/db/db.sqlite' is busy (SQLITE_PROTOCOL)
    warning: SQLite database '/nix/var/nix/db/db.sqlite' is busy (SQLITE_PROTOCOL)
    warning: SQLite database '/nix/var/nix/db/db.sqlite' is busy (SQLITE_PROTOCOL)

After:

    $ inst/bin/nix-channel --update
    unpacking channels...
    created 1 symlinks in user environment

I've seen complaints that "sandbox" caused problems under WSL but I'm
having no problems. I think recent changes could have fixed the issue.

(cherry picked from commit d25923263e)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-06-01 17:15:33 +02:00
Eelco Dolstra
a729883bf1
Bump version 2020-05-28 12:29:21 +02:00
Daiderd Jordan
a836abc5bd
installer: don't require xz on darwin
On macOS the system tar has builtin support for lzma while xz isn't
available as a separate binary.  There's no builtin package manager
there available either so having to install lzma (without nix) would be
rather painful.

(cherry picked from commit 4e6d7cb55a)
2020-05-28 12:29:03 +02:00
Eelco Dolstra
2fad345ae1
Bump version 2020-05-27 12:28:10 +02:00
Eelco Dolstra
9f4281d9ba
Remove the 'release' job
Unless the 'tested' job in the Nixpkgs/NixOS jobsets, this job isn't
actually used for anything (e.g. we don't update a channel based on
whether 'release' succeeds).

(cherry picked from commit 5392884eb1)
2020-05-27 12:27:24 +02:00
Eelco Dolstra
44d0897ac8 Merge pull request #3628 from domenkozar/2.3-installer-fixes
2.3 installer fixes
2020-05-27 11:02:23 +02:00
Domen Kožar
e15dc6783a
installer: fix unused variable
(cherry picked from commit 3d3c219d91)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 16:23:25 +02:00
Domen Kožar
f117c54318
Fix installer script bugs
- --no-channel-add didn't have effect on multi-user installation
- some new flags didn't work at all
- document all installer flags

(cherry picked from commit 1a5ac894e9)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 15:51:40 +02:00
Daiderd Jordan
07e29830c5
sandbox: fix /bin/sh on catalina
Sadly 10.15 changed /bin/sh to a shim which executes bash, this means it
can't be used anymore without also opening up the sandbox to allow bash.

    Failed to exec /bin/bash as variant for /bin/sh (1: Operation not permitted).

(cherry picked from commit 2e9bc1245c)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 12:55:19 +02:00
Daiderd Jordan
27e7153771
sandbox: allow pty devices
Nix now runs builds with a pseudo-terminal to enable colored build
output.

(cherry picked from commit f6c122aaeb)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 12:55:15 +02:00
Daiderd Jordan
f953a51d43
libstore: relax default sandbox-paths on darwin
(cherry picked from commit 7f2df903d9)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 12:55:11 +02:00
Daiderd Jordan
ec9bfa7afd
libstore: disable resolve-system-dependencies hook
This is used to determine the dependency tree of impure libraries so nix
knows what paths to open in the sandbox.  With the less restrictive
defaults it isn't needed anymore.

(cherry picked from commit afb78ebd34)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 12:55:04 +02:00
Domen Kožar
6c96858cad
Allow passing extra nix.conf to installer
(cherry picked from commit 573ff8dfca)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:04 +02:00
Domen Kožar
0c478b103b
install-multi-user: allow overriding user count
(cherry picked from commit 90b0c630a0)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:04 +02:00
Domen Kožar
b90d289785
scripts/create-darwin-volume.sh: remove unused variable
(cherry picked from commit 2a7ea2eb6c)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:04 +02:00
Daiderd Jordan
6117afc4b8
installer: don't clobber synthetic.conf
(cherry picked from commit d3df1889a1)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:03 +02:00
Travis A. Everett
248c9f7c78
focus on golden-path covering most scenarios
This should handle installation scenarios we can handle with
anything resembling confidence. Goal is approximating the existing
setup--not enforcing a best-practice...

Approaches (+ installer-handled, - manual) and configs each covers:

+ no change needed; /nix OK on boot volume:
  All pre-Catalina (regardless of T2 or FileVault use)

+ create new unencrypted volume:
  Catalina, pre-T2, no FileVault

+ create new encrypted-at-rest volume:
  Catalina, pre-T2, FileVault
  Catalina, T2, no FileVault

- require user to pre-create encrypted volume
  Catalina, T2, FileVault

(cherry picked from commit 2b0a81d92d)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:03 +02:00
Daiderd Jordan
e61e8c2588
installer: refuse apfs volume creation when FileVault is enabled
(cherry picked from commit 477d7c2d07)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:03 +02:00
Daiderd Jordan
f9c6c0a764
install: make synthetic.conf and fstab checks stricter
(cherry picked from commit bc24c09968)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:03 +02:00
Daiderd Jordan
4cafd9c825
manual: clarify volume creation section
(cherry picked from commit 3386575296)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:03 +02:00
Daiderd Jordan
da5a1fad71
install: improve output and error handling
(cherry picked from commit 04f597c3f4)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:03 +02:00
Daiderd Jordan
558d422452
manual: add apfs volume section
(cherry picked from commit ee89b7797d)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:03 +02:00
Daiderd Jordan
ebfa913825
install: hide the store volume on darwin
(cherry picked from commit caface1980)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:03 +02:00
Daiderd Jordan
5a16236307
install: show macOS 10.15 message with --daemon
(cherry picked from commit 083bb3bbfc)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:03 +02:00
Daiderd Jordan
b05437f306
install: also configure ~/.zshenv
The default login shell for users on macOS 10.15 changed from bash to
zsh.  So while generally nonstandard we need to configure it to make nix
function out of the box on macOS.

(cherry picked from commit 10202628b9)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:02 +02:00
Daiderd Jordan
1c56f18a81
install: configure and bootstrap synthetic.conf on darwin
Starting macOS 10.15 /nix can't be creasted directly anymore due to the
readonly filesystem, but synthetic.conf was introduced to enable
creating mountpoints or symlinks for special usecases like package
managers.

(cherry picked from commit 0726ad5825)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:02 +02:00
Pavol Rusnak
a98841ff1b
Expose installer configuration environment variables via command line flags
(cherry picked from commit 9e12b2f5b8)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:02 +02:00
Pavol Rusnak
64db25b1f9
Introduce NIX_INSTALLER_NO_CHANNEL_ADD which skips nix-channel --add
(cherry picked from commit 46be11b762)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:02 +02:00
Greg Price
c4ce89f151
installer: Set files read-only when copying into store
After installing Nix, I found that all the files and directories
initially copied into the store were writable, with mode 644 or 755:

  drwxr-xr-x 9 root root 4096 Dec 31  1969 /nix/store/ddmmzn4ggz1f66lwxjy64n89864yj9w9-nix-2.3.3

The reason is that that's how they were in the unpacked tarball, and
the install-multi-user script used `rsync -p` without doing anything
else to affect the permissions.

The plain `install` script for a single-user install takes care to
do a `chmod -R a-w` on each store path copied.  We could do the same
here with one more command; or we can pass `--chmod` to rsync, to
have it write the files with the desired modes in the first place.

Tested the new `rsync` command on both a Linux machine with a
reasonably-modern rsync (3.1.3) and a Mac with its default, ancient,
rsync 2.6.9, and it works as expected on both.  Thankfully the latter
is just new enough to have `--chmod`, which dates to rsync 2.6.7.

(cherry picked from commit 26851dd2c2)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:02 +02:00
Philipp Middendorf
18b1e65158
installer: also test for xz to unpack
(cherry picked from commit 9450dece24)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:02 +02:00
Robert Hensing
a49950d817
README, error msg: http -> https
(cherry picked from commit 9080d5d924)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:02 +02:00
Eelco Dolstra
b278892471
nixos.org/releases -> releases.nixos.org
(cherry picked from commit e063c71a79)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:02 +02:00
Rovanion Luckey
c4702f938c
installer: Handle edge case where the nix-daemon is already running on the system
On a systemd-based Linux distribution: If the user has previously had multi-user Nix installed on the system, removed it and then reinstalled multi-user Nix again the old nix-daemon.service will still be running when `scripts/install-systemd-multi-user.sh` tries to start it which results in nothing being done and the old daemon continuing its run.

When a normal user then tries to use Nix through the daemon the nix binary will fail to connect to the nix-daemon as it does not belong to the currently installed Nix system. See below for steps to reproduce the issue that motivated this change.

$ sh <(curl https://nixos.org/nix/install) --daemon

$ sudo rm -rf /etc/nix /nix /root/.nix-profile /root/.nix-defexpr /root/.nix-channels /home/nix-installer/.nix-profile /home/nix-installer/.nix-defexpr /home/nix-installer/.nix-channels ~/.nix-channels ~/.nix-defexpr/ ~/.nix-profile /etc/profile.d/nix.sh.backup-before-nix /etc/profile.d/nix.sh; sed -i '/added by Nix installer$/d' ~/.bash_profile

$ unset NIX_REMOTE

$ sh <(curl https://nixos.org/nix/install) --daemon

└$ export NIX_REMOTE=daemon

└$ nix-env -iA nixpkgs.hello
installing 'hello-2.10'
error: cannot connect to daemon at '/nix/var/nix/daemon-socket/socket': No such file or directory
(use '--show-trace' to show detailed location information)

└$ sudo systemctl restart nix-daemon.service

└$ nix-env -iA nixpkgs.hello
installing 'hello-2.10'
these paths will be fetched (6.09 MiB download, 27.04 MiB unpacked):
  /nix/store/2g75chlbpxlrqn15zlby2dfh8hr9qwbk-hello-2.10
  /nix/store/aag9d1y4wcddzzrpfmfp9lcmc7skd7jk-glibc-2.27
copying path '/nix/store/aag9d1y4wcddzzrpfmfp9lcmc7skd7jk-glibc-2.27' from 'https://cache.nixos.org'...
copying path '/nix/store/2g75chlbpxlrqn15zlby2dfh8hr9qwbk-hello-2.10' from 'https://cache.nixos.org'...
building '/nix/store/w9adagg6vlikr799nkkqc9la5hbbpgmi-user-environment.drv'...
created 2 symlinks in user environment

(cherry picked from commit a413594baf)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:02 +02:00
Michael Forney
47a12576ff
Pass -J to tar for xz decompression
Some tar implementations can't auto-detect compression formats, so
they must be specified explicitly.

(cherry picked from commit 43eb7b6756)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:01 +02:00
Eelco Dolstra
dd9c8a5f60
Remove $NIX_USER_PROFILE_DIR
This is not used anywhere.

(cherry picked from commit 1c3ccba0f5)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:01 +02:00
Michael Forney
8673883b40
Pass -P to cp to preserve symlinks
This is commonly the default behavior with -R, but POSIX leaves the
default unspecified.

(cherry picked from commit 10414d467b)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-05-26 11:39:01 +02:00
Eelco Dolstra
90b3b31dc2
Bump version 2020-04-10 15:05:30 +02:00
Greg Price
f5941e14e0
installer: Fix terminal colors.
The install-multi-user script uses blue, green, and red colors, as
well as bold and underline, to add helpful formatting that helps
structure its rather voluminous output.

Unfortunately, the terminal escape sequences it uses are not quite
well-formed.  The relevant information is all there, just obscured
by some extra noise, a leading parameter `38`.  Empirically, the
result is:

 * On macOS, in both Terminal.app and iTerm2, the spurious `38` is
   ignored, the rest of the escape sequence is applied, and the colors
   show up as intended.

 * On Linux, in at least gnome-terminal and xterm, the spurious `38`
   and the next parameter after it are ignored, and what's left is
   applied.  So in the sequence `38;4;32`, the 4 (underline) is
   ignored but the 32 (green) takes effect; in a more typical sequence
   like `38;34`, the 34 (blue) is ignored and nothing happens.

These codes are all unchanged since this script's origins as a
Darwin-only script -- so the fact that they work fine in common macOS
terminals goes some way to explain how the bug arose.

Happily, we can make the colors work as intended by just deleting the
extra `38;`.  Tested in all four terminals mentioned above; the new
codes work correctly on all of them, and on the two macOS terminals
they work exactly the same as before.

---

In a bit more technical detail -- perhaps more than anyone, me
included, ever wanted to know, but now that I've gone and learned it
I'll write it down anyway :) -- here's what's happening in these codes:

An ECMA-48 "control sequence" begins with `\033[` aka "CSI", contains
any number of parameters as semicolon-separated decimal numbers (plus
sometimes other wrinkles), and ends with a byte from 0x40..0x7e.  In
our case, with `m` aka "SGR", "Select Graphic Rendition".

An SGR control sequence `\033[...m` sets colors, fonts, text styles,
etc.  In particular a parameter `31` means red, `32` green, `34` blue,
`4` underline, and `0` means reset to normal.  Those are all we use.

There is also a `38`.  This is used for setting colors too... but it
needs arguments.  `38;5;nn` is color nn from a 256-color palette, and
`38;2;rr;gg;bb` has the given RGB values.

There is no meaning defined for `38;1` or `38;34` etc.  On seeing a
parameter `38` followed by an unrecognized argument for it, apparently
some implementations (as seen on macOS) discard only the `38` and
others (as seen on Linux) discard the argument too before resuming.

(cherry picked from commit 7313aa267b)
2020-04-10 10:49:33 +02:00
Tobias Möst
a25214a2bc
Fix PR_SET_PDEATHSIG results in Broken pipe (#2395)
The ssh client is lazily started by the first worker thread, that
requires a ssh connection. To avoid the ssh client to be killed, when
the worker process is stopped, do not set PR_SET_PDEATHSIG.

(cherry picked from commit 3e347220c8)
2020-04-10 10:45:45 +02:00
Eelco Dolstra
6d01e9a623
Simplify
(cherry picked from commit d1b238ec3c)
2020-04-10 10:45:40 +02:00
Profpatsch
7afd8321ed
libstore/ssh: Improve error message on failing execvp
If the `throw` is reached, this means that execvp into `ssh` wasn’t
successful. We can hint at a usual problem, which is a missing `ssh`
executable.

Test with:

```
env PATH= ./result/bin/nix-copy-closure --builders '' unusedhost
```

and the bash version with

```
env PATH= ./result/bin/nix-copy-closure --builders '' localhost
```

(cherry picked from commit 38b29fb72c)
2020-04-10 10:45:34 +02:00
mlatus
2007b4a89b fix placeholder not substituted in passAsFile
(cherry picked from commit 12556e5709)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-04-10 10:39:35 +02:00
Daiderd Jordan
eba0892d08 libexpr: show expression in assertion errors
Includes the expression of the condition in the assertion message if
the assertion failed, making assertions much easier to debug. eg.

    error: assertion (withPython -> (python2Packages != null)) failed at pkgs/tools/security/nmap/default.nix:11:1

(cherry picked from commit 307bcb9a8e)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-04-10 10:39:35 +02:00
Cole Helbling
7fee49ef37 Don't retry on "unsupported protocol" error
When encountering an unsupported protocol, there's no need to retry.
Chances are, it won't suddenly be supported between retry attempts;
error instead. Otherwise, you see something like the following:

    $ nix-env -i -f git://git@github.com/foo/bar
    warning: unable to download 'git://git@github.com/foo/bar': Unsupported protocol (1); retrying in 335 ms
    warning: unable to download 'git://git@github.com/foo/bar': Unsupported protocol (1); retrying in 604 ms
    warning: unable to download 'git://git@github.com/foo/bar': Unsupported protocol (1); retrying in 1340 ms
    warning: unable to download 'git://git@github.com/foo/bar': Unsupported protocol (1); retrying in 2685 ms

With this change, you now see:

    $ nix-env -i -f git://git@github.com/foo/bar
    error: unable to download 'git://git@github.com/foo/bar': Unsupported protocol (1)

(cherry picked from commit c976cb0b8a)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-04-10 10:39:35 +02:00
Eelco Dolstra
e914cfb06f Downloader: Only write data to the sink on a 200 response
Hopefully fixes #3278.

(cherry picked from commit 1ab8d6ac18)
Signed-off-by: Domen Kožar <domen@dev.si>
2020-04-10 10:39:35 +02:00
Eelco Dolstra
d77eaf7976
style.css: Remove
This file is licensed under the GPL. Originally, Nix was also
GPL-licensed so that was fine. However, we later changed the license
to the LGPL but missed the fact that style.css has an incompatible
license.

Since the Nix manual at nixos.org uses its own styling, we can remove
this file.

Fixes #3392.

(cherry picked from commit 9c7e90f414)
2020-03-13 15:07:45 +01:00
Eelco Dolstra
8999beacc3
mk/README.md: Remove
The make-rules repo is not maintained.

(cherry picked from commit cc5c81822d)
2020-03-13 15:07:42 +01:00
Robert Hensing
d549250069 pathInfoCache: Respect disk cache TTLs #3398 2020-03-12 10:33:52 +01:00