Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multi-user installation with a symlinked store #4022

Closed
wants to merge 1 commit into from

Conversation

@maljub01
Copy link
Contributor

maljub01 commented Sep 16, 2020

Installing Nix with a symlinked store is not recommended, but is nevertheless
supported according to the documentation.

However, even when setting NIX_IGNORE_SYMLINK_STORE=1, installation still fails
with the following error:

I am executing:

    $ sudo /nix/store/aizhr07dljmlbf17wfrj40x3s0b5iv3d-nix-2.3.4/bin/nix-store --load-db

to load data for the first time in to the Nix Database

error: the path '/nix' is a symlink; this is not allowed for the Nix store and its parent directories

This is because sudo does not preserve environment variables and so the environment variable
NIX_IGNORE_SYMLINK_STORE will always be undefined when evaluated by nix-store.

This change makes sudo preserve the relevant environment variable in order to make installation
work again.

Installing Nix with a symlinked store is not recommended, but is nevertheless
supported according to the documentation.

However, even when setting `NIX_IGNORE_SYMLINK_STORE=1`, installation still fails
with the following error:

```
I am executing:

    $ sudo /nix/store/aizhr07dljmlbf17wfrj40x3s0b5iv3d-nix-2.3.4/bin/nix-store --load-db

to load data for the first time in to the Nix Database

error: the path '/nix' is a symlink; this is not allowed for the Nix store and its parent directories
```

This is because sudo does not preserve environment variables and so the environment variable
`NIX_IGNORE_SYMLINK_STORE` will always be undefined when evaluated by `nix-store`.

This change makes sudo preserve the relevant environment variable in order to make installation
work again.
@maljub01
Copy link
Contributor Author

maljub01 commented Sep 16, 2020

This potentially fixes #374 and #3513.

@maljub01
Copy link
Contributor Author

maljub01 commented Sep 17, 2020

Thank you for the review. However, although this does allow the installation to succeed, I've run into several issues allover the place where things failed because of the missing environment variable.

Given how many other things are broken and the brittleness of trying to pipe through the environment variable everywhere, I now prefer to close this in favor of implementing #2926.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.