diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 170 |
1 files changed, 105 insertions, 65 deletions
@@ -1,6 +1,6 @@ # NixOS Configuration -A modular NixOS flake configuration for managing multiple machines (kronos laptop, herra desktop) with a layered architecture and swappable desktop rices. +A modular NixOS flake configuration for managing multiple machines (kronos, herra, mystra) with a layered architecture and swappable desktop rices. ## Quick Start @@ -8,6 +8,11 @@ A modular NixOS flake configuration for managing multiple machines (kronos lapto # Apply configuration sudo nixos-rebuild switch +# Build for specific host +sudo nixos-rebuild switch --flake .#kronos +sudo nixos-rebuild switch --flake .#herra +sudo nixos-rebuild switch --flake .#mystra + # Test without applying sudo nixos-rebuild test @@ -16,34 +21,40 @@ nix flake check # Preview changes sudo nixos-rebuild dry-run + +# Update flake inputs +nix flake update ``` ## Architecture ``` -flake.nix # Entry point, defines inputs +flake.nix # Entry point - assigns rices to hosts ↓ -hosts/{kronos,herra}/ # Per-machine configs - ├─ configuration.nix # Machine identity +hosts/{kronos,herra,mystra}/ # Per-machine configs + ├─ configuration.nix # Machine identity + overrides └─ hardware-configuration.nix # Hardware (autogenerated) -system/ # System-wide config - └─ default.nix # Orchestrator +system/ # System-wide base config + └─ default.nix # Orchestrator (base modules only) ├─ boot.nix, audio.nix, bluetooth.nix ├─ networking.nix, graphics.nix ├─ packages.nix, programs.nix, services.nix - ├─ users.nix, nix.nix - ├─ desktop.nix # X11 + i3wm - └─ stylix.nix # Theming + └─ users.nix, nix.nix + +home/rices/{rice}/system.nix # Rice system config + ├─ Desktop (X11 + i3wm) + └─ Stylix (theming) home/mun/ # User "mun" config └─ default.nix # User orchestrator ├─ programs/ # git, ssh, zsh - └─ (imports active rice) + └─ (imports rice via specialArgs) -home/rices/ # Desktop rices - ├─ nord-blue/ # Current active rice - └─ original/ # Alternative rice +home/rices/ # Desktop rices (home-manager) + ├─ nord-blue/ # Complete rice + ├─ original/ # Complete rice + └─ cosmic/ # WIP rice ``` ## Directory Structure @@ -54,15 +65,21 @@ home/rices/ # Desktop rices ├── flake.lock # Reproducibility lock │ ├── hosts/ -│ ├── kronos/ # Laptop +│ ├── kronos/ # Machine 1 │ │ ├── configuration.nix │ │ └── hardware-configuration.nix -│ └── herra/ # Desktop (dual-boot) +│ ├── herra/ # Machine 2 (desktop, dual-boot, Zen kernel) +│ │ ├── configuration.nix +│ │ ├── hardware-configuration.nix +│ │ ├── packages.nix +│ │ ├── audio.nix +│ │ └── drivers.nix +│ └── mystra/ # Machine 3 │ ├── configuration.nix │ └── hardware-configuration.nix │ -├── system/ # System-wide modules -│ ├── default.nix # Imports all system modules +├── system/ # System-wide base modules +│ ├── default.nix # Imports all base system modules │ ├── nix.nix # Nix settings, flakes │ ├── boot.nix # Bootloader, kernel │ ├── audio.nix # Pipewire @@ -72,9 +89,7 @@ home/rices/ # Desktop rices │ ├── packages.nix # System packages │ ├── programs.nix # System programs │ ├── services.nix # System services -│ ├── users.nix # User accounts -│ ├── desktop.nix # X11 + i3wm -│ └── stylix.nix # Theme framework +│ └── users.nix # User accounts │ └── home/ ├── mun/ # User "mun" @@ -85,45 +100,53 @@ home/rices/ # Desktop rices │ └── zsh.nix │ └── rices/ # Desktop themes - ├── nord-blue/ # Active rice - │ ├── default.nix - │ ├── variables.nix # Colors, wallpaper + ├── nord-blue/ # Complete rice + │ ├── system.nix # Desktop + stylix config + │ ├── default.nix # Home-manager modules │ ├── i3.nix │ ├── alacritty.nix │ ├── nvim.nix │ ├── helix.nix │ ├── picom.nix - │ ├── fastfetch.nix - │ └── wallpapers/ + │ └── fastfetch.nix + │ + ├── original/ # Complete rice + │ ├── system.nix # Desktop + stylix config + │ ├── default.nix # Home-manager modules + │ ├── variables.nix # Color definitions + │ ├── i3.nix + │ ├── kitty.nix + │ ├── polybar.nix + │ ├── rofi.nix + │ ├── dunst.nix + │ ├── neovim.nix + │ ├── nnn.nix + │ ├── picom.nix + │ ├── scripts.nix + │ └── xdg.nix │ - └── original/ # Alternative rice - ├── default.nix - ├── variables.nix - ├── i3.nix - ├── kitty.nix - ├── polybar.nix - ├── rofi.nix - ├── dunst.nix - ├── neovim.nix - ├── nnn.nix - ├── picom.nix - ├── scripts.nix - └── xdg.nix + └── cosmic/ # WIP rice + ├── system.nix # Desktop + stylix config + ├── default.nix # Home-manager modules + └── fluxbox.nix ``` ## Configuration Layers ### 1. System Layer (`system/`) -Applied to all machines. Contains boot, networking, audio, graphics, packages, services, users, and desktop environment setup. +Base system config applied to all machines: boot, networking, audio, graphics, packages, services, users. Does NOT include desktop or stylix (moved to rice layer). ### 2. Machine Layer (`hosts/`) -Per-machine identity (hostname) and hardware configuration. +Per-machine identity (hostname), hardware configuration, and optional machine-specific overrides (e.g., herra uses Zen kernel). -### 3. User Layer (`home/mun/`) -User-specific programs: git, ssh, zsh config, and imports the active rice. +### 3. Rice System Layer (`home/rices/*/system.nix`) +Desktop environment (X11 + i3wm) and stylix theming (colors, fonts, cursor). Imported at system level in flake. -### 4. Rice Layer (`home/rices/`) -Desktop theming: window manager config, terminal, editor, status bar, colors. +### 4. User Layer (`home/mun/`) +User-specific programs: git, ssh, zsh config. Imports the active rice via specialArgs. + +### 5. Rice Home Layer (`home/rices/*/`) +Desktop application configs: window manager, terminal, editor, compositor. Imported at home-manager level. ## Adding Configurations @@ -144,52 +167,69 @@ environment.systemPackages = with pkgs; [ 2. Add to `home/mun/default.nix` imports **New rice module:** -1. Create file in the active rice directory +1. Create file in target rice directory (e.g., `home/rices/nord-blue/mymodule.nix`) 2. Add to that rice's `default.nix` imports ## Switching Rices -Edit `home/mun/default.nix`: +Rices are assigned per-host in `flake.nix`. Edit the `nixosConfigurations` section: ```nix -imports = [ - ./programs/git.nix - ./programs/ssh.nix - ./programs/zsh.nix - # Change rice here: - ../rices/nord-blue # current - # ../rices/original # alternative -]; +nixosConfigurations = { + kronos = mkSystem "kronos" "nord-blue"; # Laptop uses nord-blue + herra = mkSystem "herra" "cosmic"; # Desktop uses cosmic + mystra = mkSystem "mystra" "nord-blue"; # Another machine uses nord-blue +}; ``` Then rebuild: `sudo nixos-rebuild switch` +Each rice is imported twice: +1. **System-level**: `home/rices/${rice}/system.nix` (desktop + stylix) +2. **Home-level**: `home/rices/${rice}` (app configs via specialArgs) + ## Creating a New Rice 1. Create directory: `home/rices/my-rice/` -2. Create `default.nix` orchestrator -3. Create `variables.nix` with colors -4. Add application configs (i3.nix, terminal, etc.) -5. Import in `home/mun/default.nix` +2. Create `system.nix` with desktop environment and stylix config +3. Create `default.nix` orchestrator (imports home-manager modules) +4. Add application configs (i3.nix, terminal, editor, etc.) +5. Optional: Create `variables.nix` for shared color variables +6. Assign to host in `flake.nix`: `myhost = mkSystem "myhost" "my-rice";` ## Machine-Specific Config -Each host has minimal configuration - just hostname and hardware: +Each host has minimal configuration - hostname, hardware, and optional overrides: ```nix -# hosts/kronos/configuration.nix +# hosts/kronos/configuration.nix (minimal) { imports = [ ./hardware-configuration.nix ]; networking.hostName = "kronos"; } + +# hosts/herra/configuration.nix (with overrides) +{ + imports = [ + ./hardware-configuration.nix + ./packages.nix + ./audio.nix + ./drivers.nix + ]; + networking.hostName = "herra"; + boot.loader.grub.useOSProber = true; # Dual-boot with Windows + boot.kernelPackages = lib.mkForce pkgs.linuxPackages_zen; # Gaming kernel +} ``` All shared config lives in `system/` and `home/`. ## Flake Inputs -- `nixpkgs` - NixOS 25.11 -- `nixpkgs-unstable` - Latest packages via `pkgs.unstable.*` -- `home-manager` - 25.11 -- `stylix` - Theming framework -- `fenix` - Rust toolchain +- `nixpkgs` - NixOS 25.11 (stable) +- `nixpkgs-unstable` - Rolling release, accessible via `pkgs.unstable.*` +- `home-manager` - 25.11 (user environment manager) +- `stylix` - System-wide theming framework (base16 colors, fonts, cursor) +- `fenix` - Rust toolchain manager (provides latest stable/nightly Rust) +- `crane` - Nix build system for Rust projects +- `nixowos` - NixOS branding and theming (os-release customization) |
