diff --git a/README.md b/README.md new file mode 100644 index 0000000..4ba1e6b --- /dev/null +++ b/README.md @@ -0,0 +1,170 @@ +# NixOS + +Personal NixOS infrastructure managed declaratively with Nix Flakes. + +This repository contains the configurations I use to build and maintain my desktop, home server, and standalone boot environments. The goal is to keep system configuration reproducible, infrastructure manageable as code, and system-specific components separated into reusable modules. + +## Overview + +The repository defines four independent NixOS configurations: + +| Configuration | Purpose | +|---|---| +| `nixos-desktop` | Daily-use desktop environment | +| `nixos-server` | Self-hosted services and infrastructure | +| `nixos-bootdrive` | Standalone bootable environment on an external drive | +| `nixos-bootpxe` | Diskless network-boot environment | + +All configurations are defined as Flake outputs and share common modules where appropriate. + +## Architecture + +The repository follows a modular structure. Shared functionality is separated from machine-specific configuration, while independent environments retain their own hardware and service definitions. + +```text +. +├── bootable/ # Standalone boot environments +├── desktop/ # Desktop configuration +│ └── mods/ # Desktop-specific modules +├── home/ # Home Manager configurations +│ └── mods/ # User environment configuration +├── mods/ # Shared system modules +├── server/ # Server configuration +│ └── mods/ # Server service modules +├── common.nix # Shared system configuration +├── flake.nix # Flake inputs and system outputs +└── .sops.yaml # SOPS encryption configuration +``` + +### Shared configuration + +Common modules provide functionality used across multiple configurations: + +- Base system configuration and package management. +- Limine bootloader with Secure Boot support. +- AmneziaWG kernel module and networking integration. +- Filesystem and encrypted storage configuration. +- SOPS-based secret management. + +Home Manager is used to manage user environments independently from the system configuration. + +## Desktop + +The desktop configuration provides a daily-use Linux workstation. + +Main components: + +- Niri Wayland compositor. +- Noctalia desktop shell. +- Noctalia Greeter. +- PipeWire audio. +- NetworkManager. +- QEMU/KVM virtualization. +- Home Manager for user-specific configuration. + +Hardware-specific settings are kept separate from the main desktop configuration. + +## Server + +The server configuration describes a self-hosted environment running on NixOS. + +Services include: + +| Service | Purpose | +|---|---| +| Forgejo | Git hosting | +| PostgreSQL | Database management | +| Nginx | Reverse proxy and web server | +| PHP-FPM | PHP application runtime | +| Nextcloud | File synchronization | +| Vaultwarden | Password management | +| Grafana | Monitoring and visualization | +| Prometheus | Metrics collection | +| Postfix | Mail transfer | +| Dovecot | Mail access | + +TLS certificates are managed through ACME. Service credentials and sensitive configuration are supplied through SOPS rather than stored directly in Nix expressions. + +The server also includes systemd-based automation for network monitoring and maintenance tasks. + +## Boot environments + +Two additional configurations provide standalone boot environments. + +### Boot drive + +`nixos-bootdrive` is intended to run from an external storage device. + +It provides a portable system with disk utilities, hardware inspection tools, and filesystem configuration independent of the main desktop installation. + +### PXE boot + +`nixos-bootpxe` provides a diskless NixOS environment booted over the network. + +The implementation uses: + +- Network boot through PXE. +- Network initialization in the initrd. +- NFSv4 as the root filesystem. +- Dedicated Ethernet and bridge configuration. +- A separate network configuration for the PXE environment. + +The desktop configuration also contains the corresponding PXE server infrastructure, including bridge networking, DHCP, TFTP, and NFS. + +## Security + +Security-related configuration is integrated into the system rather than maintained as a separate manual setup. + +- Full-disk encryption with LUKS. +- Secure Boot using locally managed keys. +- Limine bootloader integration. +- TPM2 support where applicable. +- SOPS with Age for secret encryption. +- SSH public-key authentication. +- Explicit firewall configuration. +- TLS certificates managed through ACME. + +Encrypted secrets are kept separate from ordinary configuration and decrypted at runtime. + +## Technology stack + +- **Operating system:** NixOS +- **Configuration language:** Nix +- **Build and deployment:** Nix Flakes +- **User environment:** Home Manager +- **Secret management:** sops-nix / Age +- **Bootloader:** Limine +- **Networking:** NetworkManager, AmneziaWG, NFS, dnsmasq +- **Virtualization:** QEMU / KVM +- **Monitoring:** Prometheus / Grafana +- **Web infrastructure:** Nginx, PHP-FPM, PostgreSQL + +## Usage + +The repository exposes the following Flake configurations: + +```bash +# Desktop +sudo nixos-rebuild switch --flake .#nixos-desktop + +# Server +sudo nixos-rebuild switch --flake .#nixos-server + +# Bootable environments +nix build .#nixosConfigurations.nixos-bootdrive.config.system.build.toplevel +nix build .#nixosConfigurations.nixos-bootpxe.config.system.build.toplevel +``` + +Format the repository: + +```bash +nix fmt +``` + +## Notes + +This is a personal infrastructure repository, not a universal NixOS distribution or a ready-to-use installation framework. + +Configurations contain machine-specific settings, network parameters, and assumptions about the underlying hardware and environment. Adapt them before using them on other systems. + +The project is continuously maintained and reflects the actual infrastructure and configuration decisions made over time.