Ok, let’s close the nix and profile discussion.
I tried to figure out how nix is dealing with it but the daemon somehow puts nix
installed binaries at the front of the PATH at the very end of a shell/terminal start.
At bit more research about how nix
works and maybe limit the build tools to a specific nix-shell
or so might help here as well ^^, but I feel like we really lose the focus of what is planned to be done in this topic → building the “camera as system app” magisk module.
So here what I did for now:
# the file
/etc/profile.d/nix.sh
# points to:
/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
# which is read-only and cannot be adjusted (without modifying it what I would not do/recommend as I don't want to "hack" nix that way)
# and it consists of several lines but also the one I was looking for:
--> export PATH="$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:$PATH"
As it feels quite special what I’m complaining about ("I want a specific adb+fastboot to be used, while still using the build tools I got via nix
?), I just renamed the two binaries I was complaining about. This will at least prevent for now, that I accidentally use them:
ls -l /nix/store/ | grep android-tools
-r--r--r-- 1 root root 2933 1. Jan 1970 16xcqfjlbc48f8j7bg0lr4bbw314dvw4-android-tools-31.0.3p1.tar.xz.drv
-r--r--r-- 1 root root 3505 1. Jan 1970 c182syxdfjwrx1apm5s5am40g4qfwyvz-android-tools-31.0.3p1.drv
dr-xr-xr-x 5 root root 4096 1. Jan 1970 kashma2vqhr321xdw7smpx65dzj0ki9w-android-tools-31.0.3p1
cd /nix/store/kashma2vqhr321xdw7smpx65dzj0ki9w-android-tools-31.0.3p1/bin
mv adb adb.disabled
mv fastboot fastboot.disabled
(maybe not very sustainable in case the nix android tools will be updated or so, but anyway it’s fine for now)
@xblax In general to answer “Why do you need a newer adb or fastboot and don’t just use the debian default one?” There was a requirement by Calyx to update this (at least fastboot) otherwise the flash script will not go on? I also saw some people reported issues and had to update it. I double checked the flash-all.sh of FP4 Calyx factory image and found this:
if ! [ $($(which fastboot) --version | grep "version" | cut -c18-23 | sed 's/\.//g' ) -ge 3103 ]; then
echo "fastboot too old; please download the latest version at https://developer.android.com/studio/releases/platform-tools.html"
exit 1
fi
→ has to be -ge
(“greater than or equal”) 3103
Debian/PureOS: Version 28.0.2-debian
nix: Version 31.0.3p1-android-tools
manual downloaded: Version 33.0.2-8557947
→ conclusion: nix is still ok, debian too old (at least for Calyx, Lineage might not be that picky - at least I always used the debian version with my FP2), so it was ok/needed for me to update it before flashing CalyxOS (for the FP4).