previous study | index | next study
1. Bio / Persona
More than 10 years of Linux experience, 1-2 years experience in professional software development, writing Rust and Elixir.
Regular Arch Linux user.
2. Prior Nix experience
Nix beginner, less than 6 months of experience. Daily NixOS user, but has difficulties fixing issues in the current installation.
3. Approaches to learning Nix
Biggest issues with documentation is that even hot topics are covered sloppily, and hard to discover where one should look for information. Cases in point:
-
Use flakes or not?
It’s a significant change of how to do things, and the concensus seems to be that this is the way forward, but there is a lot of noise surrounding this. Posts on Tweag blog are very basic, mostly focused on pinning, but not clear how it relates to system configurations.
- NixOS/nixpkgs#192584 Flakes are not mentioned in official documentation
- NixOS/nix.dev#281 teaching Nix 3 CLI and Flakes
- NixOS/nix.dev#242 flakes tutorial
-
The prevalent advice for most NixOS user configuration question, but it is not straightforward to use, especially when one never worked with dotfiles in an organized manner before.
-
What is Nix?
Found Wil T’s videos which clear this up.
-
Hard to judge what are examples of essential and accidental complexity in the Nix ecosystem.
4. Using Nix
Kick-off problem: syncthing
does not start automatically. Simply running syncthing
works, but not as a service.
Looks up “Syncthing” page in the nixos.wiki, but wants to start it as a user service, and the example only shows it for NixOS.
Opens NixOS manual, but there’s nothing about Syncthing. NixOS/nixpkgs#193297
NOTE
There is now a section in 57.2. systemd in NixOS to help with setting up system and user systemd services.
Goes to Home Manager’s GitHub repo, which has its own configuration module for Syncthing. Follows 3.2. Standalone setup section to set up Home Manager with flakes by using a hand-rolled script apply-users.sh
(based on the instructions in the aforementioned section):
nix build .#homeManagerConfigurations.<user>.activationPackage
./result/activate
The generated home.nix
is working.
Figures out how to query the status of systemd user services. One of the services belonging to Syncthing that did not start is syncthingtray
.
systemctl --user status syncthingtray.service
It shows that it had errored out on something about libraries.
The troubleshooting session stops here to talk about the sources of frustration when it comes to finding a solution to one’s problems:
-
How to debug an issue, especially if it does not work as documented?
Participant: Tried to iron out configuration issues with
nix repl
, but got stuck fast. It would be great if one could debug on one’s own or if there would be a general troubleshooting guide, because my Nix knowledge is not enough to approach this.
nixOS/nix#7117 -
People usually ask on the NixOS Discourse or in the chat when they have configuration issues. Knowledge gets scattered all over the place, making relevant examples hard to find, and I haven’t asked about my issue yet.
Interviewer: Why did you not ask on the forum?
Participant: It would help a lot to have guides on how to build a sandbox / container / VM to reproduce the error and/or to produce a minimal example.Interviewer: Would a communication map help finding solutions?
Participant: discourse#22118 Some guidance would still be helpful about how to ask good questions on Discourse. -
What is a recommended directory structure for configuration files? Or is there a template somewhere or a best practice at least?
NixOS/nixpkgs#194189 -
Some of the found examples use overlays, and it is hard to figure out the rationale behind why they are usually organized the way they are (e.g., split apart from the
default.nix
in many cases).
NixOS/nixpkgs#194198 -
The configurations I’ve seen use many modules; never had a need for custom modules, and not sure what they are for.
NixOS/nixpkgs#194554 -
Some configuration examples were from people using one repository for multiple systems.
discourse#22230 -
The nixos.wiki’s Configuration Collection is great, but it would be so much better if there would a description accompanying each configuration about how the authors arrived at their solutions.
The session ends here.