This is my NixOS config as a Nix flake eventually containing my (almost) complete setup from a desktop, to a server, to a personalized installer, to your mom, almost everything. This configuration setup can be described with a list of features:
-
Contain EVERYTHING! Unify home-manager and NixOS configuration (and maybe other environments such as nix-darwin and system-manager in case I have use cases for those) into one flake. Also throw in some NixVim configs in there, some Disko configurations, and make a sticky note about systems-manager and nix-darwin for the near future. This is basically a monorepo for everything Nix-related needs.
-
Fully modular configurations for each of the Nix-configurable environments including my NixOS systems, home-manager configurations, and NixVim builds. Furthermore, they can be attached to a wider-scoped environment provided there is an integration for it. For specific examples…
-
We can have our home-manager configurations to be attached to multiple NixOS systems smoothly. They are also available as a standalone configuration to be deployed by
home-manager
tool which is nice. -
We can include NixVim configs into home-manager configs and NixOS systems. Similar to home-manager configurations, they are also available as a standalone configuration found in
nixvimConfigurations
attribute in the flake output. -
We can also include our Disko configurations to NixOS systems to quickly include filesystem entries. Once again, also available as a standalone configuration to be usable for
disko
tool.
All of these is made possible with flake-parts with flake modules encouraging each of the configuration to be as composable as the functional paradigm that Nix encourages.
-
-
Deploy the same NixOS configuration for more than one system, in multiple output images generated with nixos-generators, and as part of the deployment cluster with deploy-rs. You can even configure what nixpkgs branch (and home-manager branch) it will use.
-
Features custom desktop configurations as a fully independent desktop session (aka similar to how typical desktop environments are deployed). You can even test them quickly in a VM by running
nix run github:foo-dogsquared/nixos-config#run-workflow-with-vm — $WORKFLOW_NAME
. -
Take full advantage of Nix module system with the cluster-wide custom modules [1]. This design bleeds into configuring the NixOS systems and home-manager users by designing host-specific modules and user-specific modules, respectively.
-
Integrate every single component of the Nix ecosystem under the sun (that I use, anyways). Want to declare a NixOS system with two already existing home-manager users as a separate NixOS configuration (
nixosConfigurations
) and as a buildable ISO in the flake output AND have it deployable with deploy-rs? I wished for it and I got it. This is mainly powered by flakes with flake-parts framework allowing me to create bloated abstractions on top. -
It has its own website fully managed as a separate subproject. Which means that it’s cool (or over-the-top, whichever you prefer).
It’s basically my personal version of nixpkgs: a monorepo of everything I need for Nix-related things unless it sprung into life as its own project [2]. By virtue of being a monorepo AND a personal project, this is basically a platform for me to experiment ANY Nix-related shtick whether be it designing a new NixOS module to be upstreamed at some point or developing an entirely new experimental Nix app for generating a custom lockfile because Nix flakes is a bit of an ass.
Anyways, this project also has a dedicated website at https://foo-dogsquared.github.io/nixos-config which I recommend to take a gander on how this project structures its configuration (and much of the information is not covered in this README anyways).
If you want the local documentation and has angst against online documentation, you can view the source code of the book at ./docs/
.
This is an overencumbered set of NixOS configurations for different systems. For this section though, we’ll assume you’re only interested in installing the desktop configuration.
My main desktop configuration is quite big to the point where it cannot be completely installed with the regular installer from nixos.org without crashing. This is due to having not enough space given from the official installer (being a 2GB tmpfs space which is enough for most) to build most of the outputs from the desktop derivation. For this, it now requires a modified persistent live installer (thus has a requirement of a larger disk space of >64GB) to be installed first within a NixOS live installer environment first.[3]
A persistent live installer should only be intended to install the humungous configuration. It isn’t exactly made to be a NixOS-on-a-stick type but simply embiggening the root filesystem should be perfectly cromulent.
Note
|
If you want to make this into a three-part step, you can install my graphical installer config. Take note, it assumes the disk drive is at least ⇐64GB and will format it into a Btrfs filesystem. For this step, you can simply use my Disko config for the external hard drive I carry around (recommend to back those data up before using). nix-shell -p disko git
# Run the following commands as root.
disko --mode disko [--arg disk "/dev/sda"] --flake github:foo-dogsquared/nixos-config#external-hdd
nixos-install --no-root-passwd --root /mnt --flake github:foo-dogsquared/nixos-config#graphical-installer-x86_64-linux Also, the installer configuration also includes Guix which means it’s also a Guix System installer. |
Once you have a live installer in boot, you can then simply install the following commands.
It will automate everything for you including the partitioning and mounting steps (powered by Disko).
NO ADDITIONAL mount
COMMANDS NEEDED!
# Also run these as root.
disko --mode disko [--arg disk "/dev/nvme0n1"] --flake github:foo-dogsquared/nixos-config#ni-x86_64-linux
nixos-install --flake github:foo-dogsquared/nixos-config#ni-x86_64-linux
And voilà! You should have my desktop configuration installed perfectly working (assuming no interruptions or crashes went while installing my desktop config).
However, it should also be barely usable since there are a couple of missing components that are needed such as the private keys for the desktop which is required for certain tasks such as backup task with Borg among other things.
If you want to use the flake as part of the flake inputs for some reason, you can simply include it in your flake.nix
.
{
inputs.foodogsquared-flake.url = "github:foo-dogsquared/nixos-config";
}
For a better experience, I recommend using FlakeHub (with available instructions in the linked page). The FlakeHub flake follows a rolling release model so all of the releases are under 0.x.
THERE’S NO STABILITY PROMISE HERE! YOU KNOW WHY!?! BECAUSE DEBUGGING IN NIX (whether in nixpkgs' module system or outside of it) IS ONE OF THE MOST PAINFUL EXPERIENCE IT MIGHT AS WELL BE CLASSIFIED AS A TIME MACHINE BECAUSE OF HOW FAR IT SETS YOU BACK, GODDAMN! MIGHT AS WELL USE THE BETTER ALTERNATIVE CALLED GUIX AND LEARN GUILE SCHEME FROM SCRATCH INSTEAD. [4]
If you’re one of the unfortunate users for whatever reason, sorry but I’m afraid there’s no such word as "stability" in this project’s dictionary (or most Nix projects, really ;p). Not every commit successfully builds because of the way how the project is managed (which is very very badly):
-
All of the included changes are pushed in one fell swoop over time instead of carefully testing each of them.
-
There’s barely any testing infrastructure set (at least until I set it up).
-
NixOS and home-manager configurations are able to be deployed in pure evaluation mode and suddenly it’s not (most of the time, it isn’t).
-
Module interfaces change all the time.
-
Packages can be left unmaintained and vanish at any time. [5]
This is my personal NixOS configuration, after all. It serves more of a platform to experiment with the Nix ecosystem rather than something that it’s meant to be used by others. There are some parts of the configuration that eventually sprung as its own project such as the Guix overlay (which eventually upstreamed into nixpkgs, hoorah!). Hopefully, more of them can be like that in the future (provided I still use Nix and have some time for it).
In order of priority:
-
✓ Create custom modules.
-
✓ Create a themes system similar to this NixOS config.
-
✓ Create a good workflow for creating ISOs.
-
✓ Create development shells.
-
✓ Manage secrets with agenix.
-
❏ Create a good workflow for tests.
-
✓ 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.
-
Set most program configurations with Nix. This is especially applicable to programs I always use such as my text editor configs.
-
The reason: managing them can be chaotic when applied with Nix. The potential for it is pretty nice especially when seen with similar implementations such as Guix home environment. However, 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. Even on NixOS, yes.
-
To be a configuration framework. This is my personal configuration which means experimentation will always be here. Sudden changes can happen at any point.
This has been moved into its own dedicated page at the website. But still, we’ll list it here.
For those who care, this project is licensed under MIT license.
I just chose it to make it easier to upstream parts of this project to nixpkgs and to make it easier to copy it without much problems (just don’t forget to add attribution as indicated from the license).
Please see ./LICENSE
for the full text.
However, various subprojects found in here may be under different licenses. An example of this is the custom GNOME Shell extensions found for my main GNOME configuration which are licensed under GPLv3 only.