The first command run successfully but the second one returns an error
$ "$(nix path-info .#homeConfigurations.ubuntu.activationPackage)"/activate
Starting Home Manager activation
error: opening lock file '/nix/var/nix/profiles/per-user/ubuntu/home-manager.lock': No such file or directory
FAIL
I am not too sure why the directory was not created. I also tried nix-shell '<home-manager>' -A install but I ended up with more errors.
$ nix-shell '<home-manager>' -A install
error:
… while calling the 'import' builtin
at /nix/store/5s2sfki1h57d1iyp839v00h01ckbzxbs-home-manager/home-manager/default.nix:1:10:
1| { pkgs ? import <nixpkgs> { } }:
| ^
2|
… while calling the 'findFile' builtin
at /nix/store/5s2sfki1h57d1iyp839v00h01ckbzxbs-home-manager/home-manager/default.nix:1:17:
1| { pkgs ? import <nixpkgs> { } }:
| ^
2|
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
at «none»:0: (source not available)
FAIL
I followed the same doc and run the same command to install nix and home manager successfully on my host machine (PopOS).
Do other nix commands work?
Not really. Even after reinstalling.
Alright! We're done!
Try it! Open a new terminal, and type:
$ nix-shell -p nix-info --run "nix-info -m"
ubuntu@fourth: ~
$ exit
Connection to xxx closed.
❯ ssh fourth
Enter passphrase for key '/home/fomm/.ssh/fourth/private':
ubuntu@fourth: ~
$ nix-shell -p nix-info --run "nix-info -m"
error:
… <borked>
at «none»:0: (source not available)
… while calling the 'import' builtin
at «string»:1:18:
1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (nix-info) ]; } ""
| ^
(stack trace truncated; use '--show-trace' to show the full trace)
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
at «none»:0: (source not available)
FAIL
Is there a reason for not using the home-manager CLI?
I was unable to install the home-manager CLI.
Is the demon running?
Yes.
$ sudo systemctl status nix-daemon.service [6:45:47]
â—Ź nix-daemon.service - Nix Daemon
Loaded: loaded (/etc/systemd/system/nix-daemon.service; linked; vendor preset: enabled)
Active: active (running) since Fri 2023-03-03 06:37:20 UTC; 8min ago
TriggeredBy: â—Ź nix-daemon.socket
Docs: man:nix-daemon
https://nixos.org/manual
Main PID: 653027 (nix-daemon)
Tasks: 2 (limit: 14240)
Memory: 3.6M
CGroup: /system.slice/nix-daemon.service
└─653027 nix-daemon --daemon
Mar 03 06:37:20 fourth systemd[1]: Started Nix Daemon.
This usually means that you haven’t set up channels.
Please check nix-env -q instead for a regular command or nix shell nixpkgs#nix-info -c nix-info -m for the flake equivalent of what you did above.
What was the problem? For the first build usually nix run nixpkgs#home-manager -- build --flake ./… -- switch … is totally sufficient.
Then I am out of ideas for now…
Though from what I understand, using home-manager with --verbose would give additional information during the activation. Which could then help us to further debug.
$ nix run nixpkgs#home-manager -- build --flake . switch
Starting Home Manager activation
error: opening lock file '/nix/var/nix/profiles/per-user/ubuntu/home-manager.lock': No such file or directory
FAIL
I am not too sure why /nix/var/nix/profiles/per-user/$<username> was missing.