Skip to content

NotAShelf/nyx

Repository files navigation


Nýx

My overengineered NixOS flake: Desktops, laptops, servers and everything else that can run an OS.


Desktop Preview
Screenshot last updated 2024-03-19

High Level Overview

A high level overview of this monorepo, containing configurations for all of my machines that are running or have ran NixOS at some point in time. As I physically cannot stop tinkering with my configuration, nothing in this repository (including the overview sections) should be considered final. As such, it is not recommended to be used as a template but you are welcome to browse the codebase to your liking, you may find bits that are interesting or/and useful to you.

Warning

Almost all of the configurations contained within this repository, in some shape or form, contain age encrypted secrets - which, to you dear reader, means that they cannot be built and replicated successfully, at least in theory. I invite you to go through the modules and countless lines of Nix I have written, but I would strongly advise against attempting to boot any of those configurations unless you are not me.

Before you proceed, I would like to point you towards the credits section below where I pay tribute to the individuals who have contributed to this project, whether through code reference, suggestions, bug reports, or simply moral support.

Notable Features

  • All-in-one - Servers, desktops, laptops, virtual machines and anything you can think of. Managed in one place.
    • Sane Defaults - The modules attempt to bring the most sane defaults, while providing per-host toggles for conflicting choices.
    • Flexible Modules - Both Home-manager and NixOS modules allow users to retrieve NixOS or home-manager configurations from anywhere.
    • Extensive Configuration - Most desktop programs are configured out of the box and shared across hosts, with override options for per-host controls.
    • Custom extended library - An extended library for functions that help organize my system.
  • Shared Configurations - Reduces re-used boilerplate code by sharing modules and profiles across hosts.
  • Fully Modular - Utilizes NixOS' module system to avoid hard-coding any of the options.
    • Profiles & Roles - Provide serialized configuration sets and pluggables for easily changing large portions of configurations with less options and minimal imports.
    • Detached Homes - Home-manager configurations are able to be detached for non-NixOS usage.
    • Modularized Flake Design - With the help of flake-parts, the flake is fully modular: keeping my flake.nix cleaner than ever.
    • Declarative Themes - Using my module options, profiles and wallpkgs. Everything theming is handled inside the flake.
    • Tree-wide formatting - Format files in any language with the help of devshells and treefmt-nix modules for flake-parts.
  • Declarative nftables firewall - Flexible and overengineered1 nftables table/chain builder abstraction for easy firewall setups.
  • Personal Installation Media - Personalized ISO images for system installation and recovery.
  • Secrets Management - Manage secrets through Agenix.
  • Opt-in Impermanence - On-demand ephemeral root using BTRFS rollbacks and impermanence.
  • Encryption Ready - Supports and actively utilizes full disk encryption.
  • Wayland First - Leaves Xorg in the past where it belongs. Everything is configured around Wayland, with Xorg only as a fallback.

Repo Structure

  • flake.nix Ground zero of my system configuration. Declaring entrypoints
  • lib Personal library of functions and utilities
  • docsThe documentation for my flake repository
    • notes Notes from tedious or/and under-documented processes I have gone through. More or less a blog
    • cheatsheet Useful tips that are hard to memorize, but easy to write down
  • flake/ Individual parts of my flake, powered by flake-parts
    • modules modules provided by my flake for both internal and public use
    • pkgs packages exported by my flake
    • schemes home-baked flake schemas for upcoming flake schemas
    • templates templates for initializing flakes. Provides some language-specific flakes
    • args.nix initiate and configure nixpkgs locally
    • deployments.nix host setup for deploy-rs, currently a work in progress
    • treefmt.nix various language-specific configurations for treefmt
  • homes my personalized Home-Manager configuration module
  • hosts per-host configurations that contain machine specific instructions and setups
  • modules modularized NixOS configurations
    • core The core module that all systems depend on
      • common Module configurations shared between all hosts (except installers)
      • profiles Internal module system overrides based on host declarations
      • roles A profile-like system that work through imports and ship predefined configurations
    • extra Extra modules that are rarely imported
      • shared Modules that are both shared for outside consumption, and imported by the flake itself
      • exported Modules that are strictly for outside consumption and are not imported by the flake itself
    • options Definitions of module options used by common modules
      • meta Internal, read-only module that defines host capabilities based on other options
      • device Hardware capabilities of the host
      • documentation Local module system documentation
      • system OS-wide configurations for generic software and firmware on system level
      • theme Active theme configurations ranging from QT theme to shell colors
      • usrEnv userspace exclusive configurations. E.g. lockscreen or package sets
  • secrets Agenix secrets

Host Specifications

Name Description Type Arch
gaea Custom live media, used as an installer ISO x86_64-linux
erebus Air-gapped virtual machine/live-iso configuration for sensitive jobs ISO x86_64-linux
enyo Day-to-day desktop workstation boasting a full AMD system. Desktop x86_64-linux
helios Hetzner cloud VPS for non-critical infrastructure Server x86_64-linux
atlas Proof of concept server host that is used by my Raspberry Pi 400 Server aarch64-linux
prometheus HP Pavilion with a a GTX 1050 and i7-7700hq Laptop x86_64-linux
epimetheus Twin of prometheus, features full disk encryption in addition to everything prometheus provides Laptop x86_64-linux
hermes HP Pavilion with a Ryzen 7 7730U, and my main portable workstation. Used on-the-go Laptop x86_64-linux
icarus My 2014 Lenovo Yoga Ideapad that acts as a portable server, used for testing hardware limitations Laptop x86_64-linux
artemis VM host for testing basic NixOS concepts. Previously targeted aarch64-linux VM x86_64-linux
apollon VM host for testing networked services, generally used on servers VM x86_64-linux
leto VM host running medium-priority infrastructure inside a virtualized root server VM x86_64-linux

Credits & Special Thanks to

My special thanks go to fufexan for convincing me to use NixOS and sticking around to answer my most stupid and deranged questions, as well as my atrocious abstractions.

And to sioodmy which my configuration is initially based on. The simplicity of his configuration flake allowed me to take a foothold in the Nix world.

Awesome People

I shamelessly stole from got inspired by those folks

sioodmy - fufexan - rxyhn - NobbZ - ViperML - spikespaz - hlissner - fortuneteller2k - Max Headroom

... and surely there are more, but I tend to forget.

Anti-credits

Pretend I haven't credited those people (but I will, because they are equally awesome and I appreciate them)

n3oney - gerg-l (bald frog) - eclairevoyant - FrothyMarrow

Other Cool Resources

Resource that helped shape and improve this configuration, or resources that I strongly recommend that you read in no particular order.

Readings

Software

Software that helped this configuration become what it is, or software I find interesting

Linux

Nix/NixOS

Projects I have made to use in this repository, or otherwise cool software that are used in this repository that I would like to endorse.

  • nyxpkgs - my personal package collection
  • nvf - highly modular Neovim configuration framework for Nix/NixOS
  • schizofox - hardened Firefox configuration for the delusional and the paranoid
  • ndg - a module documentation framework for Nix projects.

Additionally, take a look at my notes/blog for my notes on Linux, and specifically challenging or tedious processes on Nix and NixOS.

License

Unless explicitly stated otherwise, all code under this repository (except for anything in docs directory) is licensed under the GPLv3, or should you prefer, under any later version of the GPL released by the FSF.

The notes and documentation available in docs directory is licensed under the CC BY License.

All code here (excluding secrets) are available for your convenience and at my expense as I choose to keep my entire system configuration public. I believe it is in Nix and NixOS community spirit to learn from and share code with other NixOS users. As such if you are directly copying a section of my configuration, please include a copyright notice at the top of the file you import the code, or as a small comment above the section you have copied.

It is not in any shape or form enforced, but your kindness and due diligence would be highly appreciated.


Preview

Desktop Preview

Screenshot last updated 2023-12-09

Footnotes

  1. I speak of overengineering not as a flaw, but as a trait that can properly describe the time and effort that this repository has taken. After 700+ recorded hours and 4000+ commits, that is the only word that can describe this project.