Usability study session #7

                               ^
< previous study | top | next study >

1. Bio / Persona

Ubuntu user.

2. Prior Nix experience

Aware of Nix but never tried. Also read the Golem article on NixOS, where the central topic is reproducibility.

7.3 Using Nix

Session starts with installing Nix the first time on a pristine Ubuntu virtual machine (VM).

Interviewer:
I told you a few things about Nix, but what do you think one could do with it?
Participant:
At the top of my head:

  • install packages as with any package manager
  • have multiple versions of a package
  • have a file that precisely describes an environment that can be transferred between machines, and used when a machine is restored (e.g., exact versions of Python, gcc, etc.)
  • also, as I understand it, packages are rebuilt every time.

Goes to search.nixos.org, looks up “keepass”, and there are 21 results. The first one seems to be the most relevant, so checks the installation option tabs (viz. nix-env, nix-shell, and “NixOS Configuration”). “We are on Ubuntu, so the relevant ones are nix-shell and nix-env. Not sure what any of them do.

Opens Learn tab on nixos.org, and then clicks on the “First steps with Nix” button (which links to the Ad hoc developer environments article). Tries nix-shell -p hello, works. Starting nix-shell without arguments gives an error. Pauses here, “I want to know how it works before using it”.

Interviewer: I want to try a new, unpublished nixos.org content on you, but you’ll have to serve my fork.

Enters git clone, and gets an error as there is no git by default on a new Ubuntu install, it seems. Doesn’t know how to install it with Nix, so starts looking online:

  • Googles nix install git, but doesn’t find the results helpful.
  • Googles nix install package.
    • Finds nix.dev, but gets confused: the content and its organization looks very similar to nixos.org, and wonders if they are the same project? Puts this aside, and heads over to the Nix manual from a link on the first page.

Looks at the table of contents in the sidebar of the Nix manual, finds 4.1 Basic Package Management, and tries a search with nix-env -qaP git.*.

INFO The `nix-env` switches used:
-q: query
-a: available
-P: print

After issuing the command, there is a long delay, it seems to hang, and then it spits out a lot of packages. Finds the output confusing at first, but then realizes that package names are listed on the left column, and some metadata on the right.

In the end, installs git with nix-env -iA nixpkgs.git based on the Nix manual.

Interviewer:
How do the commands nix-env and nix-shell differ?
Participant:
As far as I could figure out,

  • nix-env -q is just a search
  • nix-shell -p makes a shell with the package inside

Tries calling git within nix-shell -p hello, it works. Exits that shell, and then tries calling hello from nix-shell -p git, but it’s a no go, which contradicts the current mental model.

Interviewer:
(Explaines that nix-env changes the global state by installing packages imperatively; also shows the difference between user environment with .nix-profile and nix-shell by examining PATH shell environment variable.)
Would you read How Nix works??

Reads the article, and remarks / infers:

  • Nix is about reproducible environments, and it achieves this by forcing everything to be exact and unambiguous.

  • The distinction between nix-shell and nix-env is clearer now.

  • Atomic updates mean that you can go back to older versions of software.

  • Nixpkgs contains precompiled software which are available instantly.

  • purely functional programming language

    Does not know exactly what it means. Later, after reading the “Functional package language” section, it makes more sense (determinism is a major trait, specify different versions of software, etc.), but would have to use it to understand what it entails.

  • the Nix language has no notion of package or configurations

    Finds this statement just as baffling.

  • Nix store is self-evident.

  • Not interested in multi-user support.

Interviewer:
Do you know what NixOS is?
Participant:
A linux distribution using Nix; did not look into it. It’s not Ubuntu, so it does not concern me right now.

Interviewer:
Does that explain enough? Do you need more info? Do you feel confident to try something out?
Participant:
I don’t clearly understand yet what all that means, and would like to read more first. Once I have a more solid grasp, I would like to take it for a spin in a virtual machine (VM) so I can just throw it away if anything breaks.

Interviewer:
Let’s assume this VM is your actual machine. What would you want to read up on first before continuing with experimenting with Nix?
Participant:
If it was my production machine, I’d check out rollbacks first. So far, I roughly understand what Nix does, but don’t know what the programming language does; don’t think we’ll need it all that much.

Interviewer asks participant to try cowsay.

  1. Googles nix cowsay, but results are not helpful.

  2. Does a package search for cowsay next.

  3. Enters shell with nix-shell -p cowsay.

  4. Issues cowsay, gets warnings (warning: setting locale failed), and notes that error messages obscure the usage hint.

Session ends here.

archive

1 Like
Hosted by Flying Circus.