Skip to content

Instantly share code, notes, and snippets.

@btbytes
Created February 16, 2016 18:11
Show Gist options
  • Save btbytes/3e83a0716b78ffc86fdb to your computer and use it in GitHub Desktop.
Save btbytes/3e83a0716b78ffc86fdb to your computer and use it in GitHub Desktop.
Nix/NixOS leveling up

Leveling up with NixOS

I think NixOS/Nix have what I call as the "Scala/Haskell/$AlienLookingTechnology problem" (and it does not help that there is a large overlap between the these communities); that is, there are things about the technology that I really like and would like to start using immediately, but then come across a blog post, a piece of code that is so over my head that I back off and go do something else. I had this problem with Scala till I read Martin Odersky's "Scala levels: beginner to expert, application programmer to library designer" post. While there have been valid [critiques](http://erikengbrecht.blogspot.com/2011/01/martin-odersky-scala- levels.html) of this approach, the "levels" concept does offer way out for the bewildered programmer who is presented with a whole cornucopia of features, new ways of thinking and doing things.

NixOS and Nix have a lot to offer, but the combination of new ways of thinking about systems - declarative over imperative, new syntax, and the fear of replacing known ways with something entirely new, does make one nervous.

If we were to apply the same logic to NixOS, here's how we might go about it:

Level 0 - Just a user

Goals: at this level, I'm just a regular user where I'm trying to have a system configuration that is straightforward -- I use system packages provided by upstream package distribution channels. I want to have one file that can describe my machines in their entirety. Typical use cases: Personal laptop, web server hosting a blog.

What you need to learn:

  • Installing nixos
  • Installing nix on your favourite distro
  • Searching and installing packages via command line
  • Adding packages to your custom configuration
  • Studying other's configuration to lift useful things from
  • customising the behaviour of installed packages with overrides
  • Rolling back changes with confidence
  • Concepts: Expressions, channels, nix-store etc.,
  • Command line tools: nix-env, nix-channel, nix-shell etc.,

Level 1 - Custom

  • Writing packages that do not exist on NixOS official channels
  • Contributing packages to nixpkgs repository
  • Testing packages
  • Dealing with "state" information
  • Creating services
  • Concepts: Modules, reusability
  • Command line tools: ...

Level 2 - DevOps

  • Replacing / augmenting language specific packaging with confidence
  • Orchestrating "cloud hosted" machines using NixOps
  • Running CI servers (Hydra)
  • Maybe Disnix?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment