This is my NixOS config as a https://www.tweag.io/blog/2020-05-25-flakes/[Nix flake] eventually containing my (almost) complete setup from a desktop, to a server, to a personalized installer, to your mom, almost everything.
Unify https://github.com/nix-community/home-manager[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 link:./configs/home-manager[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 link:./configs/nixvim[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 link:./configs/disko/[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 https://flake.parts[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 https://github.com/nix-community/nixos-generators[nixos-generators], and as part of the deployment cluster with https://github.com/serokell/deploy-rs[deploy-rs].
* Take full advantage of Nix module system with the cluster-wide custom modules footnote:[Most of them are patterned similarly from nixpkgs which made easy to be upstreamed just in case.].
This design bleeds into configuring the NixOS systems and home-manager users by designing https://foo-dogsquared.github.io/nixos-config/04-nixos-modules/04-host-specific-modules/[host-specific modules] and https://foo-dogsquared.github.io/nixos-config/05-home-manager/#_user_specific_modules[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?
link:./modules/flake-parts/setups/nixos.nix[I wished for it and I got it.]
This is mainly powered by flakes with https://flake.parts/[flake-parts] framework allowing me to create bloated abstractions on top.
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 footnote:[Speaking of which, I also have some other Nix-related projects stored in this very repo.].
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 {docs_site} 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).
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.footnote:[Installing a live installer environment inside of a live installer environment, oooh.]
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.
For a better experience, I recommend using https://flakehub.com/flake/foo-dogsquared/nixos-config[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.
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. footnote:[Seriously though, it is pretty nice and the community especially its developers does have the advantage of hindsight and using a general-purpose programming language. If you're interested in using declarative operating systems (or even just a home environment), I recommend to try it.]
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).
* 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. footnote:[The ones I actively maintain are in nixpkgs anyways.]
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 https://github.com/foo-dogsquared/nix-overlay-guix[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).
* [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.
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 link:./LICENSE[`./LICENSE`] for the full text.