Usability study session #8

                               ^
< previous study | top | next study >

1. Bio / Persona

Frontend developer on Windows. Not familiar with Linux. Only basic experience with command line.

2. Prior Nix experience

Absolutely new to Nix.

3. Approaches to learning Nix

None; this session will be the first attempt.

4. Using Nix

Interviewer: What do you think Nix is?
Participant: Nix is this fancy new thing that allows to run arbitrary software, wherever. Reminds me of Docker, based on what I heard so far, or something to do with containers at least. That is, Nix seems to be a library or environment that you have to download to make your containers work.

Goes to nixos.org, immediately notices that it says NixOS at the top. “It sounds like an operating system, but the description also says that it is a tool.

  • Starts watching the Asciinema demo cover

    • 00:15 → Node.js console.log example

      Loves the Node.js example: “Installed Node.js with a few keystrokes! Looks amazing; reminds me of Chocolatey”. Intrigued, and wants to know how it’s done right away.

    • 00:55 → shell.nix example

      Doesn’t know what cat does, and a quick google side trip shows that it is irrelevant to what the demo is trying to convey. After watching the short script unfold, exclaims: “Cool that you can build environments. Still not clear whether Nix is an operating system though.

    • 01:40 → Docker image example

      Doesn’t understand the script’s syntax; it seems to be some logic about installation where one can specify many things. Tries to analyze it, “the question mark reminds me of ternary operator”, and chooses to ignore it for now.

    • Stops here - excited to try out Nix, and figure out how to install Node.js.

  • Clicks on the “Get started” button on the main page right next to the demo (it links to the “Learn” tab).

    • Scans the three buttons, settles on How Nix works, and starts absorbing the basics:

      • There seems to be a “store”.
      • Nix is hardcore function-oriented. “Has this design quality been chosen for its safety and reliability properties?
      • Unique identifiers (“hashes”) for packages.
      • Skips “Multiple versions” section; does not care about it.
      • Skims “Complete dependencies” section.
      • Also skips sections “Multi-user support”, “Atomic upgrades and rollbacks”, and “Garbage collection”; no idea how they are useful or how they fit in the everyday use of Nix, and not interested in the details.

      It is a huge topic, there is a lot of information, and feels a bit overwhelmed in the beginning.

      Interviewer:
      Why did you choose How Nix works to be read first?
      Participant:
      I like to know how things work before installing anything. However, there were too many things I don’t care about; the video already got to the point, and showed how powerful Nix can be. Found it mind-blowing that Node.js was pulled in the environment in one line. Totally see Nix’s potential now.

  • Continues with reading the “Explore” tab

      1. Always working development environment.

      This already strucks a chord: Everyone at work has a different setup from operating systems to favorite editors, which makes it hard to collaborate on a project without issues. It takes a lot of time setting up stuff individually, but sees Nix as a solution to this problem.

      1. One tool, many languages.

      Pauses when encountering the word “polyglot”, but a quick google search makes the meaning clear (“multilingual”). The thought of “different environments for a project” evokes an image of an example project with three backend services, each written in a different language (e.g., Java, Ruby, and Node.js, respectively).

      without using Docker or any other virtualization

      This seems to be important. “Is Nix a Docker competitor?

      Nix seems to be simple to install thus far, whereas Docker on Windows is a pain. Expects that making Nix run and installing packages should be fairly easy too.

      1. Continuous integration (CI) for free.

      Uncertain what to think about this. “When you say CI, I think of different environments”.

      1. From zero to cloud.

      Scrolls past.

    Interviewer:
    How do you feel about Nix after what you’ve just read?
    Participant:
    Really hyped, but I don’t want to read more, and want to see Nix in action. I understand that I may be skipping important information, and I still want to know how it works, but I would like to dive in right now.

  • Clicks “Download” tab.

    The mystery is lifted: Nix is not an OS. Navigates to the Nix manual page where the link “multi-user installtion” points to. There’s too much stuff, skips to running the installer instead. (Pretend it installs correctly as we are currently on NixOS.)

Wants to explore available packages, but, as seen above, the Explore page is about something else, so clicks on the search icon instead by instinct. Enters “node” to search for first, sees a lot of irrelevant results, so tries to search for “nodejs” next, and bingo.

How to install Node.js?” When clicking on the first result, it expands to show the NixOS configuration options, and it is not immediately apparent that are other tabs as well (and what they allude to). The nix-env command looks familiar, so copies it. Stops here for a second to check whether Node.js is already installed:

$ node --version

node: command not found

Not present, so executes the copied nix-env -iA nodejs command, which runs without any complaints. Would like to use VS Code, so looks it up, installs it with nix-env also, and runs code .. Curious if auto-updaing VS Code would work, and it does.

INFO Unfree packages

The vscode package wraps a proprietary software, and so it has an “unfree” license. See 2.3. Installing unfree packages of the Nixpkgs manual. In this case the following command was used:

NIXPKGS_ALLOW_UNFREE=1 nix-shell -p vscode

Current goal is to create a React project with Node.js by copy-pasting a template project.

  • Re-visit search.nixos.org, search for “react”, but no joy. Finds this understandable as it may be covered by npm. “Package manager inception?

  • Googles nixos react

    • First result is a Discourse post; not relevant as it assumes one already has React, but it was good to find out that this is the central place of the Nix community.

    • Second result is a Reddit thread; ignores it as it also assumes that React is already available.

Stops here, and wonders how to set up a development environment that could be shared with someone. Navigates to “Set up a development environment” page on nixos.org where the examples are mostly centered around Python. Figures that a default.nix file needs to be created, but doesn’t know where the syntax is coming from and how it works. Scrolls back and forth, notices nix-build, and notes that “build results seem to be something important in Nix”.

Gets stuck at coming up with a Nix expression, and tries rationalizing what would need to be done: “You make a package (or a bundle), build it with Nix, and run it from the result folder. You integrate the environment and the code to run your application. None of this helps to achieve what I wanted though.” Maybe taking a deeper dive into Nix by reading the documentation?

Interviewer:
How does that make you feel?
Participant:
Lost. I know what Nix can do, but I don’t know how to interact with it. How to use buildPythonApplication? Where does it come from?

Looks at “Set up a development environment” page again, reading it carefully. The Python example seems comprehensive, but has no idea how to make it work for other languages.

Interviewer: Would you look at “Ad hoc developer environments” article (a.k.a. “First steps with Nix”)?

Doesn’t know what “ad hoc” means but “I can tell that this is what I wanted”.

  • Section "What is a shell environment?

    Looks at at the “hello world example”, and gets disheartened again. Has a lot of questions:

    • What’s this hello program?

    • Why is it “hello world”?

    • Is this a default program in Nix? No clue why have it.

    • Here we used the -p (packages) flag to specify that we needed the hello dependency.

      • So hello is a dependency and not a program? Confused what the difference between the terms “program”, “package”, and “dependency” is.

      • Why do we need hello as a dependency?

  • Section “Searching package attribute names”

    Confused about what “attributes” are. No clue what -qaP means, but understands that it is used to search for packages on the command line, and finds this a good idea. Seems easy to use, but not confident with tools such as grep, and unfamiliar with regular expressions.

  • Section “Ad hoc shell environments”

    Sees how nix-shell can be used to create a shell, but stares at joe for a moment, having never heard of it. Another source of confusion of how vim nano joe serves as input, but realizes that nix-shell -p must accept multiple parameters. The nix-shel output doesn’t show nano - maybe it is just missing from the example, but one would expect it to be there.

    None of this helped me so far to get where I want to: find out how to make that script to share with my team.

  • Section “Beyond tooling: Python libraries”

    Brightens up seeing that Nix can also manage environment variables. Perceives this to be making things a lot easier, but no idea how Python works. Starts skimming the example in confusion, but it just gets more complicated.

  • Section “Towards reproducibulity”

    Very intrigued about the “fully reproducible example”, and did not expect the --pure switch: “I didn’t think we would need that special command to be “pure”; seems it has to do something with that hashes may be different”.

    That means only the git that Nix installed is available inside the shell.

    Ok, so --pure restricts you to the package you specified for the Nix shell, avoiding the mess in different Bash environments - and maybe something about installing different versions? Nix seems to have its own expressions, and environment to make it easier to deal with, but how to use it?

    Interviewer:
    How do you feel at this point?
    Participant:
    I feel like diving deeper and deeper, but I don’t want to look at the details so much. It is just too much extraneous information, and totally overwhelming.

  • Section “Reproducible executables”

    Alright, finally what I was looking for: we can wrap shell.nix scripts”, but doesn’t know what a shebang (#!) is, and it all gets confusing again. Infers that the script installs Python and Django, and then verifies that they work. “This is what I wanted to do with Node.js, and I would try to mimic this if I had more time.

Interviewer:
How would you sum up your Nix experience?
Participant:
Confused to the bones. I think I got the essentials, but constantly getting confused.

The session ends here.

archive

2 Likes

I wonder if anyone has done a demo for new users by:

  1. Sitting down with them individually to create a general shell.nix to emulate their usual work setup.
  2. Usher them in a room with new installs of their operating systems of preference, and fire up the shell.nix-es.

I mean, not all of the environments would be replicated with a 100% fidelity, but it would worth it just to see the reactions.

Hosted by Flying Circus.