NixOS and Home Manager config
Files
README.md

Cyclamen #

mreow! this is my nixos/home-manager/wrappers/some packages/etc nix repo flake thingyyy. its quite opinionated but one of those opinions is also modularity and reusability. so you may or may not find anything useful here for you. the other opinionated parts generally revolve around:

  • immutable good (within reason)
  • declarative config good. even in the system itself (eg. yes userborn, yes nixos-init, etc)
  • modern simplicity > legacy support (for example dont care about BIOS support for most of the systems, refind is used instead of a full on bootloader)

the name cyclamen comes from the name of one of my favourite flowers because im like poetic like that or something ... i like flowers. flowers pretty

approach to modularity #

im trying to take modularity and code organisation relatively seriously in here. both for the sake of my future self but also because i get horny over well made code. though ofc the code in here is far from perfect. its a constant work in progress.

with that said the approach to modularity here is done in "module layers". each layer takes an increasingly high level (as in removed from hardware) but also more usage specific view of the config of the system. each layer achivies its work by setting options on other modules in that layer and the layers below it (preferably only the layer directly below it but not strictly so) and reading config from said layers to understand the state of the rest of the system. ie. config definitions travel down the layers, config reads travel up the layers. in cyclamen i define 4 layers named after the morphology of cyclamen flowers:

  • earth: very hardware specific config. nixos facter reports, firmware, disko configs, etc belong here
  • roots: ~everything that happens before stage 2 PID 1. booting and initrd stuff belongs here
  • tuber: the core system. ~all the stuff PID 1 starts on its own during stage 2 to form the core "system layer" that supports whatever a user wants to do
  • flowers: the actual programs, services, etc that users use and interact with directly. "the reason everything else is here"

additionally three "meta layers" are defined:

  • nixos: all the nixos modules in nixpkgs
  • cyclamen: the core, generic cyclamen modules
  • host: config and hardware scans specific to a given host

these meta layers also layer on top of each other (host -> cyclamen -> nixos) but also each span from hardware all the way up to specific app and service configs.

i love me a good diagram so i made you one ^-^

diagram over the organisational structure of the layered modules approach of cyclamen

each arrow represents a "dependency" ie. config definition flows in the direction of the arrows and config reads flow the opposite way. the arrows arent fully strict. as mentioned above a few times layers skip through the layer below (mainly the "tuber" layer often reads from the "earth" layer to make good defaults around what system services to include to support the available hardware). some arrows are also theoretically allowed but dont get used in practice. most of the host modules are in a single "top level module" block. this refers to the config.nix which is one file even though it includes config for all three non-hardware layers. simply because splitting it up would be redundant. the arrows internal to the nixos meta layer are also arguably mostly a lie since the nixos modules do not really follow a very strict organisation of modules and their dependencies (the nixos modules are kind of a heaping mess to be honest).

theoretically i want a similar layered approach to user specific config with home-manager. but its a bit trickier to find good boundaries and generic approaches there. so theres not much to see in that direction here. in general maybe ... dont look too much at the home-manager modules and configs in this repo. they arent really that good i dont think they live up to the quality i want and i dont think you should take inspiration from them.

uhhh enjoy ig!!