Can one benefit from a partly use of nix

Hello together,

I am working in a small but growing team of software developers; working with C++, qt and cuda. Target systems are mainly ubuntu desktops and nvida boards.

I heard of the nix package manager and became interested for the reproducible enviorment. Because I think the team might benefit from this.

There are two problems to consider.

  • we do not have direct internet access. We can get files after some screening.
  • part of the team might adopt nix slowly or never.

Since nix makes the dependencies clear it should be simple to download a library form a nix repository, since the closure should contain anything needed.

Can I benefit from nix, even if it would be some island? I feel like the clearance of depencies and enviorment has enough value. But how high is the cost to work with outside of nix?

It should be simple to ‘free’ binaries from nix, by reseting the path to libraries.
I am not certain about the overhead to bring in new libraries and maybe even binaries.

Are there any points that would prevent us from benefit from nix, that might apply to our situation?
Are there any other/better ideas to start with nix?

I am looking forward to your stories and suggestion.

I’ve used Nix in a similar situation. Other devs used CMake and some scripts. I wrapped the project with Nix for my own development and was very productive instead of struggling with Boost incompatibilities and build issues. Eventually the overall project ended up including c,c++,python2,python3, ARM builds and service files. The final deployment used nix-bundle to deploy a fat binary that was self contained with all dependencies.

5 Likes

Keep in mind that nix only builds shared libraries, so while it’s easy to launch a shell where e.g. zlib is available for including and linking by using $CC or $CXX, the resulting binary only works on your own machine.

So if you need to distribute code in compiled form then you will have to build the dependencies yourself with no help from nix.

Maybe you mean Nixpkgs, because building shared libraries isn’t something inherent to Nix. For example, here is a small package collection all about static linking and cross compiling that we use at work. I think there is some efforts to have static linking switches inside Nixpkgs, but I’m not familiar with them.