2020-08-06 15:35:49 +00:00
= foo-dogsquared's NixOS config
2021-11-30 01:03:05 +00:00
:toc:
2020-08-06 15:35:49 +00:00
2021-11-25 11:55:30 +00:00
This is my NixOS config as a link:https://www.tweag.io/blog/2020-05-25-flakes/[Nix flake].
2020-08-06 15:35:49 +00:00
2021-11-25 11:55:30 +00:00
I finally have some time trying to grok flakes and redo my NixOS config from scratch after leaving NixOs (because I have work and have to quickly set things up without me trying to debug how NixOS works).
Here is the result.
2020-08-06 15:35:49 +00:00
2021-11-25 11:55:30 +00:00
== Installation
2020-08-06 15:35:49 +00:00
2021-11-25 11:55:30 +00:00
This primarily uses Nix flakes so you can have a preview of what's available in my config.
2020-08-06 15:35:49 +00:00
[source, shell]
----
2021-11-25 11:55:30 +00:00
nix flake show github:foo-dogsquared/nixos-config
2020-08-19 18:35:23 +00:00
----
2021-11-29 05:30:57 +00:00
It should export my NixOS configurations of my different hosts (of only one so far excluding VMs and VPSs ;p) among other things.
To install it, run the `nixos-install --flake github:foo-dogsquared/nixos-config#ni`.
(Please see the respective appropriate host README for more information.)
2020-10-06 22:56:04 +00:00
2020-09-01 15:10:44 +00:00
2021-11-29 10:27:56 +00:00
== Project structure
My NixOS config should look like the following:
[source, tree]
----
nixos-config
├── hosts/
├── lib/
├── modules/
├── pkgs/
├── users/
├── flake.lock
├── flake.nix
└── README.adoc
----
* link:./hosts/[`./hosts/`] contain machine-specific configuration.
This usually configures like the hardware setup, timezone, and users.
Host configurations are also exported in the flakes in `outputs.nixosConfigurations`.
2021-12-06 06:55:00 +00:00
* link:./modules/[`./modules/`] contain my custom modules including for NixOS and home-manager.
2021-11-29 10:27:56 +00:00
For more information, see the link:./modules/README.adoc[related documentation].
It is also exported from the flake in `outputs.nixosModules`.
* link:./pkgs/[`./pkgs/`] contains my custom packages.
2021-12-06 06:55:00 +00:00
It is exported in the flakes at `outputs.packages` compiled through various systems (but only `x86_64-linux` is mainly tested).
2021-11-29 10:27:56 +00:00
* link:./users/[`./users/`] contains my link:https://github.com/nix-community/home-manager[home-manager] configurations and modules.
It is exported in the flakes at `outputs.homeConfigurations`.
For more information, see the link:./users/README.adoc[related documentation].
2021-11-25 11:55:30 +00:00
== TODO
2020-09-01 15:10:44 +00:00
2021-11-25 11:55:30 +00:00
In order of priority:
2020-09-01 15:10:44 +00:00
2021-11-29 05:30:57 +00:00
* [x] Create custom modules.
* [x] Create a themes system similar to link:https://github.com/hlissner/dotfiles[this NixOS config].
2021-11-29 10:27:56 +00:00
* [x] Manage secrets with agenix.
2021-12-06 06:55:00 +00:00
* [ ] Create link:https://github.com/numtide/devshell[devshells].
2021-11-29 05:30:57 +00:00
* [x] Automate backups with NixOS config.
2021-11-29 10:27:56 +00:00
* [x] Create custom packages and export it to flakes. (Maybe consider making it to upstream)
2021-11-29 05:30:57 +00:00
* [x] Create cluser-wide configs.
* [x] Create host-wide configs.
2021-11-29 10:27:56 +00:00
* [x] Create user-specific configs with home-manager.
* [x] ~Steal~ Get some ideas from link:https://github.com/divnix/devos[this overengineered template].
* [x] Make use of other established utilities such as link:https://github.com/divnix/digga/[digga], link:https://github.com/gytis-ivaskevicius/flake-utils-plus[flake-utils-plus], and link:https://github.com/nix-community/home-manager[home-manager] once I'm familiar to create my own Nix programs.
2020-09-01 15:10:44 +00:00
2021-11-29 05:30:57 +00:00
Out of scope:
2020-09-01 15:10:44 +00:00
2021-11-29 05:30:57 +00:00
* Text editor configurations.
They are often updated. I don't want to rebuild it every time I change it.
2020-09-01 15:10:44 +00:00
2021-11-29 05:30:57 +00:00
* Migration of my link:https://github.com/foo-dogsquared/dotfiles[dotfiles].
I still use it on other non-NixOS systems.
2020-10-06 22:56:04 +00:00
2020-09-01 15:10:44 +00:00
2021-11-29 05:30:57 +00:00
== Frequently asked questions (FAQ)
2020-11-02 14:44:48 +00:00
2021-11-29 05:30:57 +00:00
[qanda]
Hello! I'm new to Nix and NixOS, where should I start?::
Oh no, you've seen the multiple configurations from other systems, didn't you?
I hope you're ready for some time understanding because the learning curve is steeper than the link:https://en.wikipedia.org/wiki/Troll_Wall[Troll Wall].
I've written link:https://foo-dogsquared.github.io/blog/posts/moving-into-nixos/[a blog post regarding my experience with Nix] with a bunch of links for getting started.
(Un)Fortunately, it is mostly the same experience now that I've revisited it.
2020-11-02 14:44:48 +00:00
2021-11-29 05:30:57 +00:00
Any requirements for this setup?::
You only need Nix 2.4 installed with the experimental features for Nix command and flakes enabled (i.e., `experimental-features = nix-command flakes`).
2020-09-01 15:10:44 +00:00
2021-11-29 10:27:56 +00:00
== Inspirations
I ~stole~ got the ideas from the following projects:
* link:https://github.com/divnix/devos[devos, an overengineered configuration framework.]
* link:https://github.com/divnix/digga/[digga, an flake utility library for your overengineered config.]
* link:https://github.com/hlissner/dotfiles/[hlissner's dotfiles, the original inspiration for the structure and whatnot.]