And then /nix/store/6gd9yardd6qk9dkgdbmh1vnac0vmkh7d-ripgrep-14.1.1/ aswell as its entire runtime dependency tree would exist in the air-gapped system.
Because Nix store paths are hermetic, that's all you need to execute e.g. /nix/store/6gd9yardd6qk9dkgdbmh1vnac0vmkh7d-ripgrep-14.1.1/bin/rg.
You'd obviously just adjust your $PATH accordingly rather than typing all of that out and typically would install this into what Nix refers to as a profile so that you have one path to add to your $PATH rather than one for each package.
I used a single package here but you could build an entire environment of many packages to your liking and it'd be the exact same as far as Nix is concerned; it's all store paths.
You do need /nix/ to exist and be writeable in the target environment for this to work though.
🤩 Woo I didn't know nix. It seem a better way to handle package !!!
But so if I have already apt that handle packages, is it compatible to use both on the same system !?
Nix stores all packages in isolation from each other; as a result there are no /bin, /sbin, /lib or /usr directories and all packages are kept in /nix/store instead.
Installing it offline could prove to be quite a challenge. If you don't actually need Nix (the package manager) to work on your target system though, you could just not install Nix and use i.e. a static Nix binary to do the store path copying.