3 ms·
The problem might not be your script, but that the system is stateful. Users can access and mutate the /usr directory, and some software will do this outside of
by sparkie 4y ago
The problem might not be your script, but that the system is stateful. Users can access and mutate the /usr directory, and some software will do this outside of the system's built-in package manager. You can also compile and link against a shared library in /usr, but then later this library may be updated, so now your app links against a different library than the one you built against.
Older package managers use a "name-version" scheme to try and avoid package conflicts, but in practice there can be different binaries which have the same "name-version" identifier and they're not always compatible.
The way Nix solves the issue is to store everything in a content-addressible store `/nix/store`, where multiple concurrent versions can be installed without naming conflicts (the directories are named with the content hash). When an app is compiled, it is linked to specific shared libraries in the nix store which will always be present on the system. The `/usr` directory then, is just a collection of symlinks to the actual content in the nix store (most recent versions), for compatibility.
Because derived packages are reproducible, they will always have the same content hash on every system on which they are deployed. As a developer then, you can target very specific shared libraries when building your software, and you know that when you deploy them, users are going to have the exact same dependencies you had when you built it.