11 ms·
nix is starting to replace all my build tools, building c code is as easy as putting together a small nix file like this: https://github.com/jb55/polyadvent/blo
by jb55 12y ago
nix is starting to replace all my build tools, building c code is as easy as putting together a small nix file like this: https://github.com/jb55/polyadvent/blob/master/default.nix https://github.com/jb55/polyadvent/blob/master/default.nix
The nixpkgs community is then responsible for making sure that the build compiles on all platforms. It's not just for C code either, nix files can be used to declare any kind of dependency. It's a full blown declarative, functional, domain specific programming language for packages. So your project can depend on haskell or python code and everything just works.
There's a heavy linux focus right now but there's a whole group of people making the packages work nicely on osx and cygwin. Check it out: http://nixos.org/nix/ http://nixos.org/nix/
- kentonv 12y agoNix is neat, but doesn't that nix file depend on a Makefile being present? This doesn't seem to replace make...
- jb55 12y agoI don't think we need another build system, what we really want is a package manager that knows how to fetch and build dependencies and gets out of your way. This is why people like npm. This is why nix is awesome.
- lmz 12y agoBut it still looks like you have a Makefile (although a rather simple one). Are you relying on nix to install the "build-depends" for your app?
- jb55 12y agoYup, it works in conjunction with other build tools. nix knows how to build make projects, cmake projects, cabal, etc. This is what allows you to depend on pretty much anything. Then I just use nix-build and it will build all the dependencies in a virtual environment and symlink the result when its finished.