Welcome to my overengineerd configuration for my computer systems. A concoction of my better hallucinations, very carefully bashed together to (hopefully) do something that is partially useful. I've made this public primarily so that it can be used as a referance. Credits are always nice, but not at all a requirement I've based large parts of it on the work of others (see the Inspiration section bellow) So it feels like the only right thing to do. (and also so that I can install it faster on my friends computers when they are looking the other way)
Caution
This config is not a finished product, and will change as a continue to learn about nix. Things will be modified, updated, added, removed and restructured without warning.
I commit each time I (successfully) rebuild. So a large amount of commits are incomplete and or broken. And as in any other code, there is definetly a ton of mistakes sprinkled throughout the code :(.
I'm not gonna tell you not to just run it, but I'll warn you that there's a good chance that it will break. This config is made for my machines, that have their own quirks. So make sure you backup your data before trying.
You should probably avoid taking major parts of the code since it kinda cripples your ability to make quick changes to it. And if you do, make sure that you have some sort of overarching understanding of what it does.
If there's anything you take out of this, (both figuratively and literally) Id recommend you to take a look at the quick-switch script (in /parts/pkgs/qs). Its a rebuild helper that commits each time you rebuild, while adding some useful metadata to each commit, like generation and kernel version, along with other things you probably want to do when rebuilding and working on your config. It might sound a bit to verbose but its really nice to have when you eventually mess something up.
A list of some of the more notable features
- home-manager, used to configure users
- impermanence, everything is wiped in reboot, only /persist actually persists
- modular, each thing is it's own module that you can enable
- nixos modules are in modules/nixos
- home-manager modules are in modules/home
- quick-switch, a rebuild and config helper
- disko, for declarative disks
- file hierarchy based hosts and users
- logic in hosts/default.nix
- machines defined in hosts/${host name}
- users defined in hosts/${host name}/users/${user name}
- ags, to create my top bar
- stylix, for system styling
- custom neovim config using mnw, a simple wrapper around neovim
- nix-portable, for when you don't have nix nor root (probably doesn't atm)
- sops-nix, used for declarative secrets
- stored (encrypted) in /secrets
# This installs my config on any computer that has nix
# Warning this will format your system with disko
# see /parts/install for more info
nix --extra-experimental-features "flakes " run github:upidapi/nixos#install
# see /parts/isos for more info
cd $NIXOS_CONFIG_PATH # where this repo is located
# build image
sudo nix build .#images.minimal-installer
# move to usb formatted with ventoy
sudo mkdir /ventoy
usb_drive=/dev/sdb1
sudo mount $usb_drive /ventoy
# move iso to usb
cp -rl $(eza --sort changed result/iso/*.iso | tail -n1) /ventoy
Some of the people that I've stolen from been inspired by. There's probably
a lot more but I tend to forget to add them. Check the bottom of the
resources.md and my github stars for repos i typically to
check for examples in.
- jakehamilton - config structure, modules, suites, etc
- notashelf - config file structure, random things
- lokegustafsson - nix config, especially the global pining of nixpkgs
- ErrorNoInternet - nixvim config used as a reference
- vimjoyer - easy to follow guides for everything nix
- NoBoilerplate - made me start my stockholm syndrome filled journey with nixos
- NobbZ - nix sops
- SebastianStork - nix sops
- EmergentMind - yubikeys, remote bootstrapping
- mic92 - dev shell