Closed ribosomerocker closed 1 month ago
Try running /nix/var/nix/profiles/nix-on-droid/activate
or /nix/var/nix/profiles/nix-on-droid/nix-on-droid-path/bin/nix-on-droid switch
.
reports sh: /nix/var/nix/profiles/nix-on-droid/nix-on-droid-path/bin/nix-on-droid: inaccessible or not found
for both
as of right now i have resorted to manually going through the commands that are ran by the bootstrap, after manually executing the contents of the login
, i reached the
echo "Installing first Nix-on-Droid generation..."
/nix/store/jqn2c18sd10aq7lddnbc3bqz0wr8gkam-nix-2.20.5/bin/nix --extra-experimental-features 'flakes nix-command' run github:nix-community/nix-on-droid/master -- switch --flake /data/data/com.termux.nix/files/home/.config/nix-on-droid
part (right before sourcing nix-on-droid-session-init, i presume that command will create the session init file so that i can source it), but after running that it gets stuck for a while at Building activation package...
and it's been there for the good part of 20 minutes. any ideas?
would someone here who has the nix-on-droid-session-init script be able to send it in this thread? i think if i just save it i wouldn't need to run through the whole bootstrapping and whenever i mess up my env i could always just paste it in there...
Can you explain what exactly you did to your nix-on-droid installation? There should be a nix-on-droid profile in /nix/var/nix/profiles/nix-on-droid/
.
Running your mentioned nix run ...
should just work, it may take some time (comparable to the time it took to initially bootstrap nix-on-droid). There should also be the nix-on-droid cachix cache configured in /etc/nix/nix.conf, that is necessary to build any nix-on-droid generations.
After I ran the switch command, it said there was some sort of duplicate packages and that i should pick one and uninstall or give higher priority to the other. I think it was something about the [
command at first, but when I nix profile remove
d it, it turns out I removed nix-on-droid entirely.
Also, that command actually completely hanged on that environment. I kept it for about 2 hours but it still did nothing-- reinstalling Nix-On-Droid took about 10 minutes or less, for what it's worth.
Anyways, I figured out a few things but I gave up in the end and reinstalled.
The few things being: firstly, here's nix-om-droid-session-init.sh
:
# Only source this once.
[ -n "$__NOD_SESS_INIT_SOURCED" ] && return
export __NOD_SESS_INIT_SOURCED=1
. "/data/data/com.termux.nix/files/home/profiled_nix.sh"
# workaround for nix 2.4, see https://github.com/NixOS/nixpkgs/issues/149791
if [[ ":$NIX_PATH:" != *":/data/data/com.termux.nix/files/home/.nix-defexpr/channels:"* ]]; then
export NIX_PATH="nixpkgs=/data/data/com.termux.nix/files/home/.nix-defexpr/channels/''${NIX_PATH:+:}$NIX_PATH"
fi
# Workaround for https://github.com/NixOS/nix/issues/1865
if [[ ":$NIX_PATH:" != *":nixpkgs=/data/data/com.termux.nix/files/home/.nix-defexpr/channels/nixpkgs/:"* ]]; then
export NIX_PATH="nixpkgs=/data/data/com.termux.nix/files/home/.nix-defexpr/channels/nixpkgs/''${NIX_PATH:+:}$NIX_PATH"
fi
(do note, the profiled_nix.sh
file is the next file under the nix.sh
section, but written to $HOME because i have permission to write there)
secondly, after that, it seems ~/.nix-profile/etc/profile.d/nix.sh
is required, but the removal also removed that file, which happens to be
nix.sh
But even if you have that and launch a shell, you will not be able to execute anything without long paths, like /nix/store/jqnxxxxxxxxx-nix/bin/nix run nixpkgs#ls
. I do not know why.
That is as far as I went before giving up on it, hopefully it's helpful for anyone else.
Thank you Gerschtli for your reply, as well.
because of doing that, I can't access any of the nix commands, nor does any of the mentioned methods of restoring the nix system help (like the one in the wiki), the reason seems to be that i am missing the
"/data/data/com.termux.nix/files/home/.nix-profile/etc/profile.d/nix-on-droid-session-init.sh"
file and i am not quite sure how to bring it back