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.
- NixOS/nixos-homepage#855 move Nix Pills to the end of recommendation list, reword logline
4. Using Nix
The starting point of this session is googling for package nix cpp
, and evaluating the search results:
-
Not helpful, too many details, and not helpful with something like
-lstd++
- nixos.wiki/C#8186 add category: Cookbook
- nixos.wiki/C#8186 specify documentation type as recipes
-
Inria’s Nix tutorial (4th result)
-
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 thenix-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.
- gitlab.inria.fr/nix-tutorial#a9c51354 lead beginners to nix.dev (discussion)
-
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.
-
Copies example file into own project.
-
Culls
buildInputs
-
Stops for a second at
src
and changes it to./.
(remembers this from Nix Pills, Chapter 7.) (Doesn’t understand whatrev
is for in the example anyway - maybe has something to do with the URL?) -
Removes
mv chord $out/bin
-
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.
- NixOS/nix.dev#882 make nix.dev official
Session ends here.