working with nix

the nix develop command

The nix develop command is for working on a repository. If our repository contains a Makefile, it will be used by the various sub-commands.

nix develop supports multiple phases and they map as follow:

phasedefault tocommandnote
configurePhase./configurenix develop --configure
buildPhasemakenix develop --build
checkPhasemake checknix develop --check
installPhasemake installnix develop --install

In the repository, running nix develop --build will build the binary using the Makefile. This is different from running nix build.

the nix build and nix run commands

for Go

For Go, there’s the buildGoModule. Looking at the source we can see there’s a definition of what will be done for each phases. As a result, we don’t have to define them ourselves.

If we run nix build in the repository, it will run the default build phase.

buildInputs or nativeBuildInputs

May 10, 2022