Commit Graph

1011 Commits

Author SHA1 Message Date
Travis A. Everett 505d6ee5e2 darwin-install: work around existing vim swapfiles
User on Matrix reported install problems which presented as
"vifs:editing error" which we traced back to vim griping about an
existing swap file. When opened interactively, it did this:

E325: ATTENTION
Found a swap file by the name "/etc/.fstab.swp"
owned by: root dated: Sön Apr 24 16:54:10 2022
file name: /private/etc/fstab
modified: YES
user name: root host name: MBP.local
process ID: 1698
While opening file "/etc/fstab"
dated: Sön Apr 24 16:56:27 2022
NEWER than swap file!
...
2022-06-01 09:41:00 -05:00
Travis A. Everett 240124f7b1 darwin-install: fix break from bad vimrc
It looks like the `--noplugin` flag added in #5489 wasn't enough to
skirt this class of vim-init error, so this is swing 2 at a full fix.
Fixes #6462.
2022-05-04 19:26:03 -05:00
Martin Schwaighofer 4f29cf1a1d installer: ask for confirmation on multi-user install without systemd
On Linux a user can go through all the way through the multi-user install
and find out at the end that they now have to manually configure their
init system to launch the nix daemon.

I suspect that for a significant number of users this is not
what they wanted. They might prefer a single-user install.
Now they have to manually uninstall nix before they can
go through the single-user install.

This introduces a confirmation dialog before the install
in that specific situation to make sure that they want to proceed.

See also: https://github.com/NixOS/nix/issues/4999#issuecomment-1064188080
This closes #4999 but rejecting it and closing that issue anyways
would also be valid.
2022-04-08 11:23:54 +02:00
Eelco Dolstra a7b12c6bd9 curl: Use --fail to catch errors 2022-04-06 13:34:25 +02:00
Artturin 7492030ed7 scripts/install-systemd-multi-user.sh: fix another typo 2022-03-31 22:14:53 +03:00
Artturin 247d2cb661 scripts/install-systemd-multi-user.sh: fix typo
sytemd-tmpfiles -> systemd-tmpfiles
2022-03-26 00:58:19 +02:00
Eelco Dolstra c9148f4ece
Merge pull request #6285 from flokli/add-tmpfile
nix-daemon.conf.in: add tmpfiles file to create nix/daemon-socket directory
2022-03-24 21:24:53 +01:00
Eelco Dolstra bb0c4b9f25 install-multi-user.sh: Preserve symlinks
We need to pass -P to ensure that symlinks are copied correctly. Fixes #6303.
2022-03-24 12:48:59 +01:00
Florian Klink 67af5f7eda scripts/install-systemd-multi-user.sh: install /etc/tmpfiles.d/nix-daemon.conf, too
While `create_directories()` from install-multi-user.sh seems to already
create parts of the directory structure, it's marked as deprecated, and
it won't hurt also copying over the tmpfiles config and have it execute
once.
2022-03-23 13:51:38 +01:00
Bjørn Forsman f4d57aa490 installer: allow overriding nix user GID and UIDs
Needed to resolve conflict in case the default GID and UIDs are in use.
2022-03-01 19:17:41 +01:00
Domen Kožar e85d565b5a
Merge pull request #6123 from abathur/fix_6122
install-darwin: fix mount permission edge-case
2022-02-28 08:45:22 +00:00
Travis A. Everett ba9a8c4b3d install-darwin: track mount permission edge-case fix
Same as 1fd127a068, but applied to a
code path (volume_pass_works -> verify_volume_pass) that the reporting
user didn't hit and wasn't able to trigger manually. I am not certain
but I suspect it will be easier to add prophylactically than to debug
if its absence causes trouble some day.
2022-02-22 12:44:15 -06:00
Eelco Dolstra b98ce19544
Merge pull request #6138 from nmattia/nm-clarify-manpath
Document usage of MANPATH in nix-profile.sh
2022-02-21 16:54:01 +01:00
Nicolas Mattia 44b7d104b4 Document usage of MANPATH in nix-profile.sh
While trying to figure out how `nix-env`/`nix profile` work I had a hard
time understand how man pages were being installed.

Took me quite some time to figure this out, thought it might be useful
to others too!
2022-02-21 13:35:55 +01:00
Travis A. Everett 1fd127a068 install-darwin: fix mount permission edge-case
Fixes #6122, which reports a problem with trying to run the installer
under another user (probably: user is not the disk "owner" and thus
can't mount the volume).
2022-02-18 23:15:37 -06:00
Guillaume Maudoux 1bec333788
Create to daemon-socket folder during install 2022-02-17 09:32:15 +01:00
Eelco Dolstra 5b809f9e0e check-hydra-status.sh: Ignore unfinished builds 2022-02-10 21:15:07 +01:00
Eelco Dolstra b8d57e2883 check-hydra-status.sh: Improve error behaviour 2022-02-10 11:10:58 +01:00
Travis A. Everett bdb5e03821 install-darwin: dodge bash 3.2 command bug
The script is trying to find chown in a cross-platform-like
way, but there's some sort of deficiency in `command -p` in
the default macOS bash 3.2. It looks like it will just use
whatever PATH is already set, instead of the "default" path.

This attempts to hard-set a PATH via `getconf PATH`. It will
just set an empty PATH if that fails for some reason. A
properly-functioning `command -p` should not care what we
set the PATH to here one way or the other.

Hopefully fixes #5768.
2022-01-21 10:47:06 -06:00
Domen Kožar 75654bacc5
Merge pull request #5521 from abathur/clearly_mark_validation_step
installer: clarify starting assumption task
2021-12-08 20:04:03 +00:00
Domen Kožar 9b2ff20e3b
Merge pull request #5489 from abathur/fix_macos_install_vim_plugins
darwin-install: fix break from bad vim plugins
2021-12-08 20:03:45 +00:00
Travis A. Everett b6d08a9e3f darwin-install: fix break from bad vim plugins 2021-12-07 19:41:22 -06:00
Jan Tojnar ae21aab456 Update manual links
Fixes: https://github.com/NixOS/nixos-homepage/issues/762
2021-12-06 16:42:57 +01:00
Travis A. Everett 3bf7a868ee darwin-install: nail down diskutil
Same purpose as de9efa3b79af7886fcf2a67b6ce97d4f96a57421

For some unclear reason, we get occasional reports from people who do
not have /usr/sbin on their PATH that the installer fails. It's a
standard part of the PATH, so I have no clue what they're doing to
remove it--but it's also fairly cheap to avoid.
2021-12-01 18:38:32 -06:00
regnat 5f64b69d23 Add a github cron to check the hydra status
Add a regular github action that will check the status of the latest
hydra evaluation.

Things aren’t ideal right now because this job will only notify “the
user who last modified the cron syntax in the workflow file” (so myself
atm). But at least that’ll give a notification for failing hydra jobs
2021-11-30 17:54:25 +01:00
Sandro Jäckel eff48e84d9
Apply some shellcheck suggestions 2021-11-19 15:18:10 +01:00
Eelco Dolstra 9cd8cffefc
Merge pull request #5607 from kmt-lnh/install-ergonomics
curl usage in install script in sync with instructions
2021-11-19 15:13:52 +01:00
Kristof Molnar-Tatai d5b36bdb58 switch order of wget and curl
This change makes the script consistent with the installation
instructions while keeping wget as an alternative.
2021-11-19 13:10:04 +01:00
Eelco Dolstra 9de324f554
Remove nix-reduce-build and nix-http-export
These scripts are not installed and haven't been updated in many
years.
2021-11-18 21:17:57 +01:00
Travis A. Everett cc78901ccb installer: make rc replacement instructions explicit 2021-11-10 14:06:18 -06:00
Travis A. Everett f7859eef49 installer: improve existing rc backup nag 2021-11-09 08:14:51 -06:00
Travis A. Everett 69431edbc1 installer: clarify starting assumption task
We had a macOS user present in Matrix with some confusion because the
lack of a clear task statement here made them think the error meant
that a problem had occurred during the preceding task in a macOS
install: "Fixing any leftover Nix volume state"
2021-11-08 17:03:09 -06:00
Travis A. Everett abdf9f2a6e darwin-install: fix already-mounted store volumes
This adds an explicit unmount of the store volume to avoid cases
where the installer can hang in await_volume when:
- the user already has a store volume
- that volume is already mounted somewhere other than /nix
- they do not take a path through the installer that results in an
  explicit unmount (as both removing and encrypting the volume
  would do)
2021-11-04 14:09:40 -05:00
Jan Van Bruggen 7d56174c1e
Reword "we"s to "I"s for consistency
This script uses multiple forms of the first-person POV:
1. "We" to refer to the Nix team (1e7c796e66/scripts/install-multi-user.sh (L72))
2. "We" to refer to the combination of the installation script & the user/executor (1e7c796e66/scripts/install-multi-user.sh (L710))
3. "We" to refer to the installation script alone (1e7c796e66/scripts/install-multi-user.sh (L602))
4. "I" to refer to the installation script alone (1e7c796e66/scripts/install-multi-user.sh (L200))

Since I prefer POV 4 to POV 3, this changes all instances of POV 3 to POV 4.
2021-11-03 18:42:32 -06:00
Anders Kaseorg 447350fe0e installer: Do not use echo -e in #!/bin/sh script
ShellCheck correctly warns:

In scripts/install-nix-from-closure.sh line 218:
                echo -e "\nif [ -e $p ]; then . $p; fi # added by Nix installer" >> "$fn"
                     ^-- SC3037: In POSIX sh, echo flags are undefined.

In scripts/install-nix-from-closure.sh line 229:
                echo -e "\nif [ -e $p ]; then . $p; fi # added by Nix installer" >> "$fn"
                     ^-- SC3037: In POSIX sh, echo flags are undefined.

Indeed, this actually breaks on Ubuntu where /bin/sh is dash.

Fixes #5458.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2021-11-02 10:27:27 -07:00
Travis A. Everett 8a3b8d0b33 darwin-install: fix incorrect fn name 2021-10-12 18:17:27 -05:00
Travis A. Everett 033081aec2 fix install on macOS monterey 2021-09-21 13:38:29 -05:00
Travis A. Everett bf2ee3c565 install: fix addVolume perm issue for some users
As reported in #5198, volume creation can fail with a permission error
for some macOS users (probably secondary user accounts?) Sudo appears
to be sufficient to avoid this.

While I'm here, I also updated the sudo invocation added in 079bde2ae
to use the _sudo explanation wrapper.
2021-09-01 19:02:25 -05:00
Eelco Dolstra 0b6bff5455
Merge pull request #5096 from AnatoleLucet/patch-1
Remove curl deps in install script
2021-08-30 13:19:00 +02:00
Eelco Dolstra 9f9b0d267f
Merge pull request #5179 from matthewbauer/use-zshrc
Revert "Use /etc/zshenv instead of /etc/zshrc for profile"
2021-08-30 13:14:18 +02:00
Matthew Bauer 959c2af557 Revert "Use /etc/zshenv instead of /etc/zshrc for profile"
This reverts commit 909d8cb293.

This messes up PATH priority since /etc/profile gets sourced AFTER
/etc/zshenv and it sets the system paths so
$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin is behind
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin. See discussion in
https://github.com/NixOS/nix/issues/4169.
2021-08-25 23:02:22 -05:00
Matthew Bauer 079bde2aef Try setting enableOwnership in macOS install
For external hard disks where ownership is not enabled by default.
2021-08-24 19:23:18 -05:00
Domen Kožar 475fc109e7 Remove rsync usage in the installer
It's not commonly installed on systems like debian,
so avoid the bootstrapping problem by using cp and
chmod.
2021-08-18 16:50:36 +02:00
Anatole Lucet 67035ee23d Remove curl deps in install script 2021-08-09 15:33:39 +02:00
Domen Kožar 97be92569c
Merge pull request #5040 from SuperSandro2000/patch-1
installer: fix --no-modify-profile help text
2021-07-23 20:40:45 +02:00
Sandro 5c4cc5e0d6
installer: update global nix.conf location 2021-07-23 19:56:30 +02:00
Sandro 142c966691
installer: fix --no-modify-profile help text 2021-07-23 19:51:37 +02:00
Jarrett Keifer c8a80e4dbe
Fix wrong hash var for aarch64-darwin binary 2021-07-05 07:48:53 -07:00
Matthew Bauer c906d6530d Support cross-compiling binaryTarball 2021-06-26 00:12:03 -05:00
Robert Hensing e30d1daf26 installer: Jeeze -> Oh no
Even if it doesn't offend me or probably most people,
this word can be considered mildly blasphemous.
2021-06-16 19:14:16 +02:00
Finn Behrens 9f1a7f9d37 Include aarch64-darwin in installer
Co-authored-by: Matthew Bauer <mjbauer95@gmail.com>
2021-06-01 09:48:35 +02:00
Patrick Hilhorst 822e338e5c
throw freenode down the memory hole 2021-05-27 21:48:39 +02:00
Anders Kaseorg d169eb2a1b
install: Fix hash variable for Darwin.arm64 (#4769)
When commit 233b61d3d6 (#4224) renamed
@binaryTarball_${system}@ to @tarballHash_${system}@, it updated this
reference for every platform except Darwin.arm64.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2021-05-11 15:43:44 +02:00
Travis A. Everett eab14a642c darwin: encrypt nix volume if filevault is enabled 2021-04-29 13:26:51 -05:00
Domen Kožar dc6a8f1548
Merge pull request #4532 from abathur/macos_nixbld_ids
fix nixbld user name/uid for macOS/darwin
2021-03-25 10:35:56 +01:00
Nicolas Stig124 FORMICHELLA 71f92741ec
Added Debian-based OS's profiles 2021-03-23 16:23:24 +01:00
Travis A. Everett 0431cf6d09 fix nixbld user name/uid for macOS 2021-03-11 10:16:34 -06:00
Domen Kožar 22aec8cef4
fix installer script 2021-02-21 15:51:49 +00:00
Domen Kožar ae4260f0a7
Generate installer script for each PR/push
This works by using Cachix feature of serving a file from
a store path.
2021-02-21 15:51:49 +00:00
Maximilian Bosch d9367a2dd1
scripts/install-nix-from-closure: only show progress if a terminal is used
While the progress dots during the copying of the store work fine on a
normal terminal, those look pretty off if the script is run inside a
provisioning script of e.g. `vagrant` or `packer` where `stderr` and
`stdout` are captured:

    default: .
    default: ..
    default: .
    default: .
    default: .

To work around this, the script checks with `-t 0` if it's
running on an actual terminal and doesn't show the progress if that's not
the case.
2021-01-22 10:35:02 +01:00
Matthew Bauer 692549c542 Use com.apple.oahd.plist for rosetta 2 detection 2020-12-04 13:28:09 -06:00
Matthew Bauer addf9f4ede Call it aarch64-darwin instead of arm64-darwin
gnu-config standardized on aarch64 for machine name so host_cpu part
of $system will always be aarch64. That means system will be
aarch64-darwin too.

uname however could report either “aarch64” (if gnu coreutils) or
“arm64” (if apple’s uname). We should support both for compatiblity
here.
2020-12-02 19:05:02 -06:00
Matthew Bauer b0de7b2016 Check for rosetta 2 support before installing 2020-12-02 18:35:48 -06:00
zimbatm 233b61d3d6
installer: simplify the per-build installation
The goal is to allow the installation and testing of arbitrary Nix
versions. Extend the base installer to accept a `--tarball-url-prefix
<url>` to change where the Nix tarball is getting downloaded from.

Once this is merged it should allow to:
1. Pick an evaluation at https://hydra.nixos.org/jobset/nix/master that
   looks healthy
2. Select the installedScript build and find the store path.

Now equipped with all of this, use an instance of nar-serve to fetch the
install script and release tarballs:

    curl -sfL https://nar-serve.numtide.com/nix/store/rkv4yh7pym941bhj0849zqdkg2546bdv-installer-script/install \
      | sh --tarball-url-prefix https://nar-serve.numtide.com/nix/store

Or with cachix, strip the /nix/store and derivation name and then:

    curl -sfL https://mycache.cachix.org/serve/rkv4yh7pym941bhj0849zqdkg2546bdv/install \
      | sh --tarball-url-prefix https://mycache.cachix.org/serve

Fixes #4047
2020-11-21 19:56:46 +01:00
Eelco Dolstra ae3191666f
Merge pull request #4171 from YorikSar/zsh-nix-profiles
Fix iterating over $NIX_PROFILES in Zsh
2020-11-17 15:53:44 +01:00
Travis A. Everett 4864df6d6b enable Darwin.arm64 to install x86_64 binary
Throwing @thefloweringash under the bus if this doesn't work, but it
sounds like Apple Silicon devices can use the x86_64 binary for now.

Fixes #4058
2020-11-10 08:48:49 -06:00
Yuriy Taraday 39fbd3d828 Fix iterating over $NIX_PROFILES in Zsh
NIX_PROFILES is space separated list of directories, and passing it into
for as is is considered to be 1-element list with the whole string. With
shwordsplit option Zsh emulates other shells in this regard ans
implicitely splits unquoted strings into words.

Fixes #4167.
2020-10-21 00:03:38 +04:00
Domen Kožar e0ca98c207
Merge pull request #3996 from abathur/macos_big_sur_fixes
Macos big sur installer fixes
2020-10-20 12:18:23 +02:00
Travis A. Everett f289bdb9d4 discourage casual Big Sur installs 2020-10-19 12:28:08 -05:00
Travis A. Everett c40bad4151 create missing profile files to fix zsh envvars
Env vars for ZSH were moved from /etc/zshrc to /etc/zshenv in #3608
to address an issue with zshrc getting clobbered by OS updates, but
/etc/zshenv doesn't exist by default--so *nothing* would get set up
for zsh users unless they already happened to have /etc/zshenv.

Creating these files if they don't exist. Also cut separate creation
of profile.d/nix.sh, which isn't needed now.
2020-10-19 12:25:52 -05:00
Travis A. Everett b719f686a8 fix skipped multi-user install steps on macOS
Some of the changes in #3788 to support non-systemd Nix installs
don't appear to be aware that the darwin installer exists, which
resulted in some skipped steps and inappropriate instructions.
2020-10-19 12:25:52 -05:00
Travis A. Everett fe807904e5 adapt to apfs.util flag diff in catalina/big sur
Fixes #3957. Just runs both forms to minimize moving parts.
2020-10-19 12:24:31 -05:00
Travis A. Everett e736f8f6e4 replace xpath with xmllint --xpath; simplify
As mentioned in previous commit, Big Sur changes the syntax for the
xpath command slightly.

In the process of testing out replacements for these, I noticed a few
small simplification wins.
2020-10-19 12:24:04 -05:00
Travis A. Everett 1f02b65c59 fix xpath and conditional bugs; xpath -> xmllint
- xpath -> xmllint: xpath's cli interface changed in Big Sur
  rather than add conditional logic for picking the correct
  syntax for xpath, I'm changing to xmllint --xpath, which
  appears to be consistent across versions I've tested...

- /plist/dict/key[text()='Writable']/following-sibling::true[1]
  doesn't do quite what's expected. It was written to try to
  select a <true /> node paired with the Writable key, but it
  will also select the *next* <true /> node that appears even
  if it was paired with another key.

- I think there's also a logic bug in the conditionals here.
  I'm not sure anyone ever actuall saw it, thanks to the xpath
  bug, though. With the xpath fix, this conditional passes if /nix
  does not exist, / IS writable, and the version is Catalina+.

  I think it meant to test for /nix does not exist, / is NOT
  writable, and the version is Catalina+. I reworked this lightly
  to make it a little clearer at the code level.
2020-10-19 12:23:29 -05:00
Travis A. Everett 9c3dc9d7ca update macOS version handling for Big Sur
Keeping this commit narrow for reviewability, but some of these
conditionals will change in subsequent commits in this PR.

Fixes #3852.
2020-10-19 12:22:30 -05:00
Eelco Dolstra 924712eef1 Installer: Set a known umask
Fixes #1560, #2377.
2020-09-30 17:48:49 +02:00
Eelco Dolstra 3e30710d95
Merge pull request #3788 from crinklywrappr/master
Add a script to install nix on non-systemd systems.
2020-07-31 16:44:26 +02:00
Alex Kovar 3294b0a4b0 Add newline to profile sourcing line #3393 2020-07-18 10:24:22 -05:00
Daniel Fitzpatrick 39859b853c merged systemd installer with non-systemd installer. 2020-07-07 15:08:23 -05:00
Daniel Fitzpatrick fd42176a21 Add a script to install nix on non-systemd systems. 2020-07-06 21:59:18 -05:00
Jörg Thalheim 3685f4eec6
docs/installer: add correct curl flags
also see https://nixos.org/download.html
2020-06-23 23:04:10 +01:00
Daiderd Jordan 4e6d7cb55a
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.
2020-05-27 20:58:42 +02:00
Eelco Dolstra 228857efc6 Merge pull request #3608 from surajbarkale/patch-1
Use /etc/zshenv instead of /etc/zshrc for profile
2020-05-27 11:10:08 +02:00
Domen Kožar 3d3c219d91
installer: fix unused variable 2020-05-26 16:23:03 +02:00
Domen Kožar 1a5ac894e9
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
2020-05-26 15:49:26 +02:00
Domen Kožar 909bdfb4b4
Merge pull request #3375 from domenkozar/multi-user-count
install-multi-user: allow overriding user count
2020-05-25 17:53:24 +02:00
Domen Kožar 573ff8dfca
Allow passing extra nix.conf to installer 2020-05-25 17:31:46 +02:00
Domen Kožar 90b0c630a0
install-multi-user: allow overriding user count 2020-05-25 17:16:38 +02:00
Domen Kožar 2a7ea2eb6c
scripts/create-darwin-volume.sh: remove unused variable 2020-05-23 11:12:05 +02:00
Suraj Barkale 909d8cb293
Use /etc/zshenv instead of /etc/zshrc for profile
As noted in https://github.com/NixOS/nix/issues/3456 the `/etc/zshenv` file provides a better place for sourcing the nix environment.
2020-05-22 11:05:25 +10:00
Daiderd Jordan d3df1889a1
installer: don't clobber synthetic.conf 2020-05-21 20:03:09 +02:00
Travis A. Everett 2b0a81d92d
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
2020-05-21 19:58:11 +02:00
Daiderd Jordan 477d7c2d07
installer: refuse apfs volume creation when FileVault is enabled 2020-05-21 19:58:11 +02:00
Daiderd Jordan bc24c09968
install: make synthetic.conf and fstab checks stricter 2020-05-21 19:58:11 +02:00
Daiderd Jordan 04f597c3f4
install: improve output and error handling 2020-05-21 19:58:11 +02:00
Daiderd Jordan caface1980
install: hide the store volume on darwin 2020-05-21 19:58:11 +02:00
Daiderd Jordan 083bb3bbfc
install: show macOS 10.15 message with --daemon 2020-05-21 19:58:10 +02:00
Daiderd Jordan 10202628b9
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.
2020-05-21 19:58:10 +02:00
Daiderd Jordan 0726ad5825
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.
2020-05-21 19:58:10 +02:00
Pavol Rusnak 9e12b2f5b8
Expose installer configuration environment variables via command line flags 2020-05-12 19:00:45 +02:00