'First steps on nix: Doing configure/make the Nix way?
I want to see what the experience is when working with non-nix-ready packages - most of the tools I use aren't part of nixpkgs just yet, so I want to work on that and try some things out. In order to really see what I want to specify as dependencies, I have to first build and install the package "the normal way".
For instance: ObjFW
It has no Nix package specification (or, in proper terminology, there is no deriviation for it) in it's repo or somewhere else. So to see if it works as intended, I would like to know what the "nix way" is for the classic ./configure && make && make install step. I know that I can use nix-shell -p ... to spawn a shell with only the packages I want, and use $configureflags and the various $NIX_[C|LD]FLAGS to get all the proper flags I need. But how do I then actually install the package into an environment?
I am still a little lost on Nix, tried it out today in WSL2 (there is a Github repo that provides an image) and I am very impressed by the idea so far! Still lots to learn, and learning how to adapt to the Nix way of handling "most" packages is basically the first thing I want to do.
Solution 1:[1]
The "Nix Pills" about writing derivations can be a good starting point: https://nixos.org/guides/nix-pills/our-first-derivation.html This is also how I started out.
Keep in mind that this starts out with the basics and that you do not have to manually do every steps shown there. However, reading through all of them helps with understanding.
As Charles Duffy already mentioned, Nixpkgs comes with the function stdenv.mkDerivation that does many of the common steps for building packages/derivations for you.
It also comes with a default builder that should easily work with anything that uses the ./configure && make && make install approach.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | stovemeerkat |
