Usability study session #5

< previous study | top | next study >

1. Bio / Persona

Software developer for 5 years. Has been using Matlab since college, and learned a lot with and from Python; they have a community where people agree on how to write good code. Rust seems to do the same, whereas JavaScript is more like the Wild West.

Has no functional programming background.

Started out with Linux using Arch, and describes it as very fragile, with the system ending up becoming unrecoverably broken after 1.5-2 years. Configurations were not version controlled. Continued with Mint ever since it proved to be stable.

2. Prior Nix experience

Discovered Nix after switching back to Arch on a Framework laptop, because of not wanting to continue using Ansible to manage configurations. “Too much boilerplate for default things”.

Likes the NixOS way of configuring a system, but was initially intimidated by Nix because of not having any functional programming experience. Started reading a lot of online resources, and talked to other Nix newcomers when questions arose.

3. Approaches to learning Nix

Finds the learning curve very steep.

Hasn’t packaged anything yet, but would like to try it at one point as it feels fairly straightforward after reading Nix Pills.

Does not care much about packaging software however, and the main objective is to use NixOS as a daily driver for “serious developer stuff”. But to make data science tools work, one needs at least mid-level expertise with Nix; just using jupyterWith requries a lot of experience, because examples are not that great.

Had to build custom NixOS ISOs eventually to support new hardware, and Wil T’s videos helped a lot when gotten stuck. However, there was way too much information in the episodes, and couldn’t understand it all. The last two videos were switching over to flakes that made things more confusing.

Set up the system in the end using Home Manager, but does not understand how it works. “What do functions return, and what are the data types?

4. Using Nix

Kick-off issue: Neovim itself works fine, but there is no syntax highlighting, so wants to make Neovim plugins work with Home Manager because keeps getting the following error:

"node" is not executable

Most of the help online is only about non-Nix problems, and googling for nixos coc neovim node is not executable didn’t yield much useful info. Stuck somewhat on how to debug this further, then heads over to, and checks its “Neovim” page. Nothing useful there regarding the issue at hand, but a reference to Home Manager gives a hint to look up its configuration options page, and check what is available for Neovim. Notices that coc-nvim is duplicated in vimPlugins as programs.neovim.coc.enable = true.

Have you considered asking for help online?
Had good feedback from posting on the NixOS Discourse or on the unofficial Discord. Turnaround time for short questions is around 1-2 hours on Discord, and around 1-2 days on Discourse. Not using the official Matrix chat as I didn’t feel welcome with my questions.

Switching to another problem: created a few functions to convert color strings for nix-colors, and wanted to upstream these, but not sure how to do tests.

Nix Pills and the Nixpkgs manual appear comprehensive on how to make tests for NixOS modules, but how to write tests for functions? Found a Discourse post Unit tests for nix functions from December 2020 that links to nix-community/nixt (doesn’t seem to be maintained anymore) and to the definition of runTests in Nixpkgs. Found lib/tests/misc.nix close by in the repo that seems to be using runTests to test the functions of the stdlib. Wonders whether the tests should be put in a derivation?

New goal: pulling in a flake should run the unit tests when it gets built.

How does one call the tests in lib/tests? Presumes that lib/tests/release.nix has to play a role, but doesn’t know what calls it at the top level. Tries a GitHub search in the Nixpkgs repo for release.nix, and lib/tests/maintainers.nix pops up with a comment on how to run tests with nix-build:

nix-build nixpkgs/lib/tests/release.nix

lib/debug.nix also has a comment on how to run individual tests.

Feels very new to the Nix language, and insecure about writing functions. Definitely wants tests, but doesn’t want to roll own testing framework for flakes. The lack of guidance on testing best practices is not helpful either, but flakes seem to have a specific architecture, so asks around in the Nix community: what’s a good way to do things?

No consensus on what the right way is. There’s information online everywhere (“tab explosion”), and concludes that Nix and flakes are perhaps still in their infancy; people are waiting them to mature before committing to an existing approach.

A few ideas that would have helped in that situation:

  • The Nix language doesn’t seem to change very often, so have an intro video, explaining that this will get you most of the way there.

    • An example outline:
      • using the Nix language
        • unit testing
        • documentation strings
        • formatting
  • Have navigation and guidance on how to do things in the Nix ecosystem:

    • map out where to go for which problem
    • state clearly what the state of the art is (“software developers don’t like clever solutions”)

Session ends here.

5. Concluding discussion

Have you come across any of the following resources?

Nix by Example: it seems stale and old enough that some examples do not work anymore as presented. Doesn’t show how to write functions.

How does the ArchWiki stay up to date? Is it because so many are working on it?
Even though it has the reputation of being the best documentation out there, it still appears to be unstable. For example, some use case specifics had been deleted between visits.

What do you think about the Nix / Nixpkgs / NixOS manuals?
I had read through parts of the NixOS manual, but didn’t think to look for a Nixpkgs manual. Generally, I google/duckduckgo search for things and rarely did searches lead me back to the Nixpkgs manual. Now that I know they exist, I’ll be using them more often.

In your opinion, who would benefit the most from learning about Nix and NixOS?
We could address people who are comfortable on the shell and would like to try window managers instead of a desktop environment. People who want control! Your system state and development is precious, and you don’t want people to break your system underneath you with random updates.


Hosted by Flying Circus.