Nix related stuff
I'm playing around with Nix and recently NixOS, here will be the public part of my configurations and other toy examples on my path towards learning Nix.
Disclaimer
WARNING: the code here is crap :) Follow it if you want to learn.
Installing Nix
Can be done as simple as:
curl https://nixos.org/nix/install | sh
Bootstrap multiuser:
curl https://nixos.org/nix/install -o install
sh ./install --daemon
Using Nix as a package manager
I found using Nix as a package manager is the best entry drug to the shiny NixOS world. It even works on MacOS.
Update channel:
nix-channel --update
Search and install package:
nix-enq -qaP | grep go
nix-env -iA nixpkgs.go
Update all packages:
nix-enq -u
Getting started
NixPills is a great resource to learn. As you can see this stuff is also inspired by Sam's blog post series too.
Motivation
Domen Kožar in his blog post can explain better than me why Nix is the way to go.
I've been using Puppet or as I call it the PHP of configuration management since version 2 :) It always becomes a tangled mess eventhough I've been trying to follow role/profile/module pattern. A strong functional language has a steep learning curve, but I believe in the long term the simple composability pays off.
TODO
Testing is currently done like in this suggestion https://github.com/NixOS/nixpkgs/issues/25264 and only with nix-instantiate, perhaps we need to change that?
Try nix-darwin and home-manager
CI
GitLab
target:
image: nixos/nix
variables:
NIX_PATH: "nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-18.09.tar.gz"
script:
- nix-build ...
Travis
language: nix
env:
- NIX_PATH="nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-18.09.tar.gz"