Commit graph

979 commits

Author SHA1 Message Date
Valentin Gagarin e5a2af2832 add template for installer issues
since the installer prompts users to file issues, labelling them
automatically should reduce triaging effort significantly.
2022-12-07 10:00:27 +01:00
Gabriella Gonzalez a71e3172af Add --yes option for Nix installation script 2022-10-25 16:43:00 -07:00
Stel Abrego 34e3fa3a4a Fix fish shell MANPATH creation
Previously the MANPATH was set even if MANPATH was empty beforehand
which resulted in a MANPATH of only ~/.nix-profile/share/man which
omitted the default man page directory (commonly /opt/local/share/man)
from man page results.
2022-10-03 14:37:28 -07:00
Jonathan Coates 0259702219
Use exit instead of return in fish profile
Older versions of Fish (such as those bundled with Ubuntu LTS 22.04) do
not support return outside of functions. We need to use the equivalent
exit instead.
2022-09-27 12:59:37 +01:00
hiroqn ca22936853 fix uname -m return value for armv6l/armv7l 2022-09-20 15:36:36 +09:00
Ana Hobden 8ebdbeb257 Add fish suport to installer
Before this patch, installing Nix using the Fish shell did not
work because Fish wasn't configured to add Nix to the PATH. Some
options in #1512 offered workarounds, but they typically involve
extra plugins or packages.

This patch adds native, out-of-the-box support for the Fish shell.

Note that Fish supports a `conf.d` directory, which is intended
for exactly use cases like this: software projects distributing
shell snippets. This patch takes advantage of it. The installer
doesn't append any Nix loader behavior to any Fish config file.
Because of that, the uninstall process is smooth and a reinstall
obliterates the existing nix.fish files that we place instead of
bothering the user with a backup / manual removal.

Both single-user and multi-user cases are covered. It has been
tested on Ubuntu, and a Mac with MacPorts, homebrew, and the
Fish installer pkg.

Closes #1512

Co-authored-by: Graham Christensen <graham@grahamc.com>
2022-09-13 12:56:16 -04:00
Eelco Dolstra aa4ca8b7e4
Merge pull request #4918 from roberth/installer-pc
installer: Jeeze -> Oh no
2022-09-09 16:49:59 +02:00
Dave Nicponski a2b7baa42f
Set HOME var to root's home when running nix-store as root
A [recent-ish change](https://github.com/NixOS/nix/pull/6676) logs a warning when a potentially counterintuitive situation happens.

This now causes the multi-user installer to [emit a warning](https://github.com/NixOS/nixpkgs/issues/189043) when it's doing
the "seed the Nix database" step via a low-level `nix-store --load-db` invocation.

`nix-store` functionality implementations don't actually use profiles or channels or homedir as far as i can tell.  So why are we 
hitting this code at all?  

Well, the current command approach for functionality here builds a [fat `nix` binary](https://github.com/NixOS/nix/blob/master/src/nix/local.mk#L23-L26) which has _all_ the functionality of
previous individual binaries (nix-env, nix-store, etc) bundled in, then [uses the invocation name](https://github.com/NixOS/nix/blob/master/src/nix/main.cc#L274-L277) to select the
set of commands to expose.  `nix` itself has this behavior, even when just trying to parse the (sub)command and arguments:

```
dave @ davembp2
$ nix
error: no subcommand specified
Try 'nix --help' for more information.

dave @ davembp2
$ sudo nix
warning: $HOME ('/Users/dave') is not owned by you, falling back to the one defined in the 'passwd' file
error: no subcommand specified
Try 'nix --help' for more information.

dave @ davembp2
$ HOME=~root sudo nix
error: no subcommand specified
Try 'nix --help' for more information.
```

This behavior can also be seen pretty easily with an arbitrary `nix-store` invocation:
```
dave @ davembp2 
$ nix-store --realize

dave @ davembp2 
$ sudo nix-store --realize  # what installer is doing now
warning: $HOME ('/Users/dave') is not owned by you, falling back to the one defined in the 'passwd' file

dave @ davembp2
$ sudo HOME=~root nix-store --realize  # what this PR effectively does

dave @ davembp2
$ 
```
2022-08-31 17:25:26 -04:00
Josh Soref 4d4f2d10e7
darwin-install: fix shell hint 2022-08-23 19:38:53 -04:00
Travis A. Everett 0bf52b73f4 install: only create TMPDIR if missing 2022-08-19 15:16:34 -05:00
Eelco Dolstra 823e1017d8 Ensure that $TMPDIR exists if defined 2022-08-17 21:47:01 +02:00
Eelco Dolstra 6547dcde2a Use plain mktemp
This fixes the case where $TMPDIR doesn't end in a slash.
2022-08-17 21:41:19 +02:00
Eelco Dolstra af4e8b00fb
Merge pull request #6882 from DeterminateSystems/allow-multi-user-as-root
Allow installing multi-user as root on macOS and Linux
2022-08-12 10:19:03 +02:00
Graham Christensen 7bb1e913b3 Don't prompt about using sudo if we're already root 2022-08-10 09:37:08 -04:00
Graham Christensen 64c3adbe1a install-multi-user: abstract is_root, is_os_linux, is_os_darwin 2022-08-10 09:36:45 -04:00
Tom Franklin 96b4339d86 Only fail if selinux is in enforcing 2022-08-08 00:42:18 +01:00
Eelco Dolstra c9d406ba04 Fix --no-daemon installation
It was accidentally triggering the auto-chroot code path because
/nix/var/nix didn't exist.

Fixes #6790.
2022-07-12 16:15:21 +02:00
Artturin bd3a17d00c install-multi-user: check if selinux is enabled and if it is then abort 2022-06-10 05:12:03 +03:00
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