about summary refs log tree commit diff
path: root/scripts
AgeCommit message (Collapse)AuthorFilesLines
2020-04-10 installer: Fix terminal colors.Greg Price1-6/+6
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 7313aa267b5be1e5264e4577e7bc3daec2fef282)
2020-01-04 install-multi-user.sh: Remove unused variablesEelco Dolstra1-3/+0
https://hydra.nixos.org/build/104119659 (cherry picked from commit 2f96a89646c6e55e2f1bbb80805dcbbe60fa94ae)
2020-01-04 Fix unset variable in installerSteven Shaw1-4/+1
(cherry picked from commit f0ec4b4ce478a8d2760203e8192275b88c770e1c)
2020-01-04 Copy instead of linking launch agentMatthew Bauer1-1/+1
On Catalina, the /nix filesystem might not be mounted at start time. To avoid this service not starting, we need to keep the launch agent outside of the Nix store. A wait4pid will hold for our /nix dir to be mounted. Fixes #3125. (cherry picked from commit 0847f2f1b3145a62dc34707ba788275ce6b6fc57)
2019-10-10 nix-env: Create ~/.nix-defexpr automaticallyEelco Dolstra2-23/+0
(cherry picked from commit c9159f86cc9a2fc07e2ab1217c2d8a8824123df4)
2019-10-10 nix-env: Create ~/.nix-profile automaticallyEelco Dolstra2-21/+0
(cherry picked from commit 9348f9291e5d9e4ba3c4347ea1b235640f54fd79)
2019-10-09 TypoEelco Dolstra1-1/+1
(cherry picked from commit 9277e72cb0aac72100c01334fdf25ea79d19052e)
2019-10-09 nix-profile.sh: Remove coreutils dependencyEelco Dolstra1-4/+2
(cherry picked from commit 61a6176acaa8522cbcf091a34a663ef45307fef7)
2019-10-09 nix-profile.sh: Don't create .nix-channelsEelco Dolstra2-10/+0
This is already done by the installer, so no need to do it again. (cherry picked from commit 26762ceb8629af95300c0cc8c372a99282060dc1)
2019-10-09 Remove some redundant initializationEelco Dolstra1-6/+0
(cherry picked from commit c43d9f6131102f2761f22b1ec26f345d357f169c)
2019-10-09 Remove world-writability from per-user directoriesEelco Dolstra3-32/+4
'nix-daemon' now creates subdirectories for users when they first connect. Fixes #509 (CVE-2019-17365). Should also fix #3127. (cherry picked from commit 5a303093dcae1e5ce9212616ef18f2ca51020b0d)
2019-08-28 Merge pull request #2745 from samueldr/install/detect-systemd-separatelyEelco Dolstra1-3/+7
install-multi-user: Detect and fail lack of systemd separately
2019-08-28 Merge pull request #3054 from matthewbauer/nix-dir-macosEelco Dolstra1-1/+1
Allow empty /nix directory in multi-user installer
2019-08-27 Compress binary tarballs using xzEelco Dolstra1-4/+3
Fixes https://github.com/NixOS/nix/issues/240. Apparently 'tar -xf' can decompress xz files on macOS nowadays.
2019-08-24 installer: handle network proxy in systemd installVenkateswara Rao Mandela1-0/+34
If a network proxy configuration is detected, setup an override systemd unit file for nix-daemon service with the non-empty proxy variables. Proxy detection is performed by looking for http/https/ftp proxy and no proxy variables in user environment
2019-08-22 Allow empty /nix directory in multi-user installerMatthew Bauer1-1/+1
With macOS catalina, we can no longer modify the root system volume (#2925). macOS provides a system configuration file in synthetic.conf(5) to create empty root directories. This can be used to mount /nix to a separate volume. As a result, this directory will need to already exist prior to installation. Instead, check for /nix/store and /nix/var for a live Nix installation.
2019-07-25 Add default for USER when unsetMatthew Bauer1-1/+1
uses $(id -u -n) when USER is unset, this is needed on some weird setups in Docker. Fixes #971
2019-06-17 Merge pull request #2746 from bjornfor/install-multi-user-defaultsEelco Dolstra1-3/+0
install-multi-user: reduce max-jobs from 32 to 1
2019-05-29 Replace `type` with `command -v` in install scriptJohannes Climacus1-4/+4
In POSIX sh, `type` is undefined. cf. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html#tag_20_22_04
2019-05-15 Don’t set NIX_REMOTE=daemon in daemon profileMatthew Bauer1-6/+0
This is now autodetected. There is no need to put it in the profile.
2019-05-15 Sync NIX_PROFILES between single-user and multi-user modesMatthew Bauer1-2/+2
When we are in single user mode, we still want to have access to profiles. This way things in Nixpkgs that rely on them getting set accurately are done in both cases. The point where I hit this is with using aspell which looks in NIX_PROFILES: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/aspell/default.nix Before this patch, NIX_PROFILES was never set in single user mode! This corrects that.
2019-05-15 nix-profile: Add all channels to $NIX_PATHEelco Dolstra1-4/+3
Fixes #2709.
2019-05-15 Fix shellcheck errorEelco Dolstra1-1/+1
https://hydra.nixos.org/build/93359951
2019-05-08 Merge pull request #2594 from LnL7/darwin-10.12.6Graham Christensen1-3/+5
installer: update macOS version check to 10.12.2
2019-05-01 Merge pull request #2679 from bjornfor/offline-installEelco Dolstra2-2/+13
install script: don't abort when "nix-channel --update" fails
2019-03-27 install-multi-user: remove unneeded settings from nix.confBjørn Forsman1-3/+0
Hardcoding the "max-jobs" and "cores" settings in nix.conf at install time, to the same value as Nix' built-in default, makes little sense to me.
2019-03-27 install-multi-user: reduce max-jobs from 32 to 1Bjørn Forsman1-1/+1
Having max-jobs = 32 ($NIX_USER_COUNT is hardcoded to that value) may severely overload the machine. The nix.conf(5) manual page says max-jobs defaults to 1, so let's use that value. NOTE: Both max-jobs and cores are now being set to their default value, so they can be removed alltogether.
2019-03-26 install-multi-user: Detect and fail lack of systemd separatelySamuel Dionne-Riel1-3/+7
Otherwise, the user is shown: ``` Sorry, I don't know what to do on Linux ``` Which is... not exactly right.
2019-03-24 Merge pull request #2693 from thoughtpolice/scripts/multi-user-sandboxDomen Kožar1-1/+0
scripts: remove default 'sandbox = false' from multi-user installer
2019-02-23 scripts: remove default 'sandbox = false' from multi-user installerAustin Seipp1-1/+0
Sandboxing is now enabled by default on Linux, but is still disabled on macOS. However, the installer always turned it off to ensure consistent behavior. Remove this default configuration, so we fall back to the default platform-specific value. Signed-off-by: Austin Seipp <aseipp@pobox.com>
2019-02-22 remove noop uses of nix-store --initzimbatm2-9/+0
the nix-store --init command is a noop apparently
2019-02-20 install script: don't abort when "nix-channel --update" failsBjørn Forsman2-2/+13
Instead, print a message about what happened and tell the user what can be done (run "[sudo -i] nix-channel --update nixpkgs" again at a later time). This change allows installing Nix when you're offline. Since the multi-user installer is so verbose, the message isn't printed until the end. Fixes issue #2650 ("installation without internet connection").
2019-02-14 nix.sh: Be set -u compliant.Shea Levy1-1/+1
2018-12-20 installer: update macOS version check to 10.12.2Daiderd Jordan1-3/+5
Nixpkgs will drop support for <10.12 soon and thus a nix release built using the 19.03 channel will also require a newer version of macOS.
2018-11-15 Merge pull request #2432 from luke-clifton/fixsslEelco Dolstra1-4/+7
SSL certificate search failed to find user profile certificates.
2018-10-16 install script: remove unportable command check, fixup errant escapeGraham Christensen (Target)1-2/+2
`which` isn't necessarily portable, but `command -v` is an equivalent form. Additionally, the `\'` is not necessary, as it is already quoted by `"`.
2018-10-01 nix-profile-daemon: remove cruftMatthew Bauer1-1/+1
This removes part of the PATH that were being added automatically in multi-user installs: - $HOME/.nix-profile/lib/kde4/libexec - shouldn't be needed anymore, we are now using kde5 - @localstatedir@/nix/profiles/default/lib/kde4/libexec - same as above - @localstatedir@/nix/profiles/default - shouldn't ever contain binaries
2018-09-20 Search NIX_PROFILE for SSL CALuke Clifton1-4/+7
2018-09-19 Look inside the user profileLuke Clifton1-2/+2
2018-09-01 Default to single-user installGraham Christensen1-11/+14
2018-05-30 release.nix: Generate the installer scriptEelco Dolstra1-7/+7
2018-05-30 Move installer script from nixos-homepageEelco Dolstra1-0/+67
2018-05-30 install-multi-user: support 'set -u' runs, closes #2193Graham Christensen1-1/+1
2018-05-30 nix-daemon.sh profile script: operate under `set -u`Graham Christensen1-2/+2
If the profile is sourced inside a script with `set -u`, the check for __ETC_PROFILE_NIX_SOURCED and NIX_SSL_CERT_FILE would raise an error. A simple guard around this check allows the script to operate under standard environments (where it is fairly reasonable to assume USER and HOME are set.)
2018-05-25 multi-user profile: borrow single user profiles' NIX_SSL_CERT_FILE finding logicGraham Christensen1-1/+18
2018-05-25 install-multi-user: don't force NIX_SSL_CERT_FILEGraham Christensen1-3/+9
Following the lead of the single user installer, if NIX_SSL_CERT_FILE is explicitly set prior to running, accept the user-provided version.
2018-05-25 Merge pull request #1664 from matthewbauer/patch-4Eelco Dolstra1-1/+1
Setup NIX_PATH correctly in nix-profile-daemon
2018-04-19 installer: default to the daemon installor for Linux with systemdGraham Christensen1-1/+1
Note: don't backport to 2.0-maintenance
2018-04-19 installer: allow opting in / out to the daemon installerGraham Christensen1-6/+31
By passing --daemon or --no-daemon, the installer can be forced to select one or the other installation options, despite what the automatic detection can provide. This commit can be backported to 2.0-maintenance because it explicitly turns off the daemon installation for Linux under systemd.
2018-04-04 Setup nix_path correctly in nix-profile-daemonMatthew Justin Bauer1-1/+1
We need nixpkgs to be set in NIX_PATH for Nix 1.12 to work correctly