6d33406492
Setting themes should be in `modules.themes.themes` for namespacing and the module itself is gaining options. |
||
---|---|---|
hosts | ||
lib | ||
modules | ||
pkgs | ||
secrets | ||
shells | ||
users | ||
.editorconfig | ||
.gitignore | ||
.gitmodules | ||
flake.lock | ||
flake.nix | ||
Makefile | ||
README.adoc |
This is my NixOS config as a Nix flake.
I finally have some time trying to grok flakes and redo my NixOS config from scratch after leaving it for some time (because I have work and have to quickly set things up without me trying to debug how NixOS works). Here is the result.
Installation
Since this uses Nix flakes, you should have Nix v2.4 and above installed.
This primarily uses Nix flakes so you can have a preview of what’s available in my config.
nix flake show github:foo-dogsquared/nixos-config
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.)
Project structure
My NixOS config should look like the following:
nixos-config
├── hosts/
├── lib/
├── modules/
├── pkgs/
├── secrets/
├── shells/
├── users/
├── flake.lock
├── flake.nix
└── README.adoc
-
./hosts/
contain machine-specific configuration. This usually configures like the hardware setup, timezone, and users. Host configurations are also exported in the flakes inoutputs.nixosConfigurations
. -
./modules/
contain my custom modules including NixOS and home-manager modules. For more information, see the related documentation. -
./pkgs/
contains my custom packages. It is exported in the flakes atoutputs.packages
compiled through various systems. -
./secrets/
contains my secrets managed with agenix. [1] -
./shells/
contains my development shells for interacting with the usual type of projects. Setting this up can bring benefits outside of NixOS (unless you’re interacting with projects with any OpenGL-related stuff). [2] -
./users/
contains my home-manager configurations and modules. It is exported in the flakes atoutputs.homeConfigurations
. For more information, see the related documentation.
TODO
In order of priority:
-
✓ Create custom modules.
-
✓ Create a themes system similar to this NixOS config.
-
✓ Create development shells.
-
✓ Manage secrets with agenix.
-
✓ Automate backups with NixOS config.
-
✓ Create custom packages and export it to flakes. (Maybe consider making it to upstream)
-
✓ Create cluser-wide configs.
-
✓ Create host-wide configs.
-
✓ Create user-specific configs with home-manager.
-
✓ Steal Get some ideas from this overengineered template.
-
✓ Make use of other established utilities such as digga, flake-utils-plus, and home-manager once I’m familiar to create my own Nix programs.
Out of scope:
-
Text editor configurations. They are often updated. I don’t want to rebuild it every time I change it.
-
Migration of my dotfiles. I still use it on other non-NixOS systems.
Frequently asked questions (FAQ)
-
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 Troll Wall. I’ve written 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.
-
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
).
Inspirations
I stole got the ideas from the following projects:
-
devos, an overengineered configuration framework. I’m slowly grokking Nix and its ecosystem so I didn’t use this outright. Though, this is where my config is heading to be and instead slowly making parts of my config based from this template.
-
digga, an flake utility library for your overengineered config. I also stole parts of it for my custom library. I may have to use this at some point.
-
hlissner’s dotfiles, the original inspiration for this functional abomination of a configuration. Very nice.