Broken default installation of nix-bin and nix-setup-systemd
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
nix (Debian) |
New
|
Undecided
|
Unassigned | ||
nix (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
# Context
- nix-bin can be setup in 2 ways.
- One is to let .nix-defer user local directory handle both channels and packages. This will get placed into `/home/
- Second, is to let it all be symlinked into `nix/var/
## Current setup
- nix-setup-systemd ends up setting symlinks for per-user into the user directory here:
- /usr/share/
- nix-setup-systemd also ends up setting up the NIX_PATH to per-user dir above making the assumption that it was completed in this file:
- `/usr/lib/
Firstly, this will be borked config in default installations unless the user enabled the systemd tmpfiles per user with
```
systemctl --user --now enable systemd-
```
These symlinks will never be created and it's not in any of the docs. But after enabling, this sets up for the profile, but not for channels. It should also include symlinks for channels. This results in a broken installation, as `nix-env` will work after adding user channel as described in the docs. However all attempts to do `nix-shell -p <pkg>` will error due to:
```
warning: Nix search path entry '/nix/var/
warning: Nix search path entry '/nix/var/
error:
… <borked>
at «none»:0: (source not available)
… while calling the 'import' builtin
```
This is because there is no such symlink and NIX_PATH is set to the non-existent path.
## Current contents of
```
4 #Type Path Mode UID GID Age Argument
3 d %h/.nix-defexpr
2 L %h/.nix-
1 d /nix/var/
5 L %h/.nix-profile - - - - /nix/var/
1 d /nix/var/
```
## Solutions
### Solution 1
Simplest. Remove excess config.
- Remove the symlinks entirely. Move /usr/share/
- Remove `NIX_PATH` in /usr/lib/
### Solution 2
More nix data inside /nix store
- Add channels to the symlink in /usr/share/
- Auto-enable `systemctl --user enable systemd-
ProblemType: Bug
DistroRelease: Ubuntu 24.04
Package: nix-setup-systemd 2.18.1+
ProcVersionSign
Uname: Linux 6.8.0-31-generic x86_64
ApportVersion: 2.28.1-0ubuntu2
Architecture: amd64
CasperMD5CheckR
CurrentDesktop: ubuntu:GNOME
Date: Thu May 2 12:44:59 2024
InstallationDate: Installed on 2024-04-26 (6 days ago)
InstallationMedia: Ubuntu 24.04 LTS "Noble Numbat" - Release amd64 (20240424)
PackageArchitec
SourcePackage: nix
UpgradeStatus: No upgrade log present (probably fresh install)
description: | updated |
This is really odd. There is no package called nix. Only nix-bin and nix-setup-systemd. But launchpad will only let me tag nix. Wonder if there is another launchpad bug or I'm missing something.