Usability study session #3

previous study | index | next study

1. Bio / Persona

Software engineer.

2. Prior Nix experience

Just finished packaging a C project at work with help of colleagues, and tackled packaging a personal / school project previously. Running Nix on Windows Subsystem for Linux (WSL).

3. Approaches to learning Nix

Started learning from Nix Pills (highlights Chapter 6.), but found it too deep with too many details.

4. Using Nix

The starting point of this session is googling for package nix cpp, and evaluating the search results:

  • C - NixOS Wiki

    Not helpful, too many details, and not helpful with something like -lstd++

  • Inria’s Nix tutorial (4th result)

    • Hacking Your First Package

      Tries first example by reading the instructions, looks at the example (quickly grasps the header of chord_example.nix, and runs:

      nix-build chord_example.nix
      

      The example works on first try.

      Continues following the instructions by cloning the example project and building by entering nix-shell. Doesn’t try the nix-shell --command version of the instruction, inferring that it will yield the same result, and that the only difference is that it will enter the development environment, build the project, and then exit.

      Remarks that it’s really hard to find an introduction for declaring a C/C++ development environment.

    • Moving onto the next article: Packaging Your First Experiment

      Fairly proficient with the shell, but still not sure what nix-shell does exactly, other than creating a special environment.

      This article appears less focused on Nix and more on the software to be built and run. Continues reading it regardless.

Clones the project, and tries to re-use the example Nix file as a template for a personal project, but not familiar with C development, and wondering why both make and cmake is needed.

  1. Copies example file into own project.

  2. Culls buildInputs

  3. Stops for a second at src and changes it to ./. (remembers this from Nix Pills, Chapter 7.) (Doesn’t understand what rev is for in the example anyway - maybe has something to do with the URL?)

  4. Removes mv chord $out/bin

  5. Runs nix-shell own-project.nix, builds it, and it works

Interviewer: How would you make the project, and run it in your environment, outside of nix-shell?
Participant: Would build it somehow.

Tries nix-build, gets a CMake error, but not familiar enough with CMake and Nix to make adjustments.

Session ends here.

archive

2 Likes

I want to point out Jon Ringer’s youtube channel. It helped me better than any documentation i have found on how to actually package things for nix, and how to use the different tooling.

It is disappointing that this resource is on a channel not directly affiliated with NixOS. Making it into a “you just have to know that exists” situation.

1 Like

You may be pleased to see that there is a nix.dev PR soon to be merged which places the videos more visibly. While this is not yet the front-page presence many rightfully desire, we’re slowly getting there.

2 Likes