I used it for few years that way.
If you use nix-darwin + home-manager you can also configure your mac the way you would NixOS.
Amazing tools that discovered not long ago (they aren't specific to os x) is:
niv - makes pinning to specific repos/versions in repos much easier which helps with reproducibility, especially pinning of nixpkgs version which is now controlled in your source code.
direnv + lorri - you no longer need to invoke nix-shell just cd the directory and all tooling you need for your project is suddenly available which is AWESOME.
Here's an example of using them together with packaging a python project[1] if you have lorri and direnv installed and cd to the directory, not only you have the right python version installed but also all dependencies and even the "hello" command becomes available, as if you installed it through `pip -e .`
- overlays the packages on top of nixpkgs - understands setup.cfg and can get dependencies from it
It is still not perfect, but when I find some time I think to submit a PR to nixpkgs to improve setupcfg2nix. Particularly it doesn't understand tests_require which you can list dependencies to run unit tests. Nix has equivalent checkDepends.
[1] Catalina restricts which directories can be added to the root dir. Nix uses /nix.
https://github.com/NixOS/nix/issues/2925#issuecomment-604501... documents the workaround but if you don't have a direct link it's almost impossible to find because GitHub's UI is terrible.
Also, the path isn't really hardcoded. You can use a custom path, but that means you can't use binary caches.
It ought to be possible to use binary caches and still swap out the path. (Modifying a string in an ELF executable isn't that hard.)
As far as I know it creates a new elf each time it is called (it doesn't modify a file on place) so the length of library name is not an issue.
We used to have a long and flaky shell script which set up the development environment for new engineers and CI machines (for iOS development on macOS, specifically). Now we have a very simple script which just installs nix and runs alls builds through the nix-shell. This makes builds on local machines and CI very easily reproducible. It also means that when dependencies change, we just update our nix config, and the new dependencies will automatically be fetched for all of our engineers and CI machines — no need to manually re-run the setup script.
This is my favorite part of Nix — you can do `nix-shell --run "<some command>"`, and it will make sure you have all of the correct dependencies (downloading if necessary), then run the command with those exact dependencies. This is especially magical when engineers working on other platforms have conflicting dependencies — a problem we no longer need to worry about.