mirror of
https://github.com/itme-brain/nixos.git
synced 2026-03-23 16:29:42 -04:00
refactor: reorganize flake structure and consolidate user config
Directory structure: - Move from src/ to root level (system/, user/) - Remove unused machines (workstation, vm, laptop) User configuration: - Add user/home.nix for shared defaults (pass, essentials, default modules) - Centralize user options in user/default.nix - Move submodules to consistent paths (bash/bash, git/git, neovim/nvim, vim/vim) Module reorganization: - Flatten nested module structures (remove /modules/ subdirs) - Split CLI vs GUI tools (dev/ for CLI, gui/dev/ for GUI) - Move neovim/vim to top-level modules (not under utils/) - Remove security.enable - pass now in user/home.nix - Remove utils.enable - essentials now in user/home.nix - Add security/yubikey module with yubikey-manager, age-plugin-yubikey - Move pcb, design to gui/dev/ - Replace penpot docker wrapper with nixpkgs penpot-desktop - Remove i3 config - Remove deprecated wsl.nativeSystemd option GUI improvements: - Browser-focused mimeApps in gui/default.nix - Each WM handles its own auto-start via profileExtra Cleanup: - Update README with new structure - Update justfile paths and valid systems - Fix submodule paths in .gitmodules
This commit is contained in:
parent
ac95d1c23d
commit
14efa80cab
141 changed files with 505 additions and 1561 deletions
191
README.md
191
README.md
|
|
@ -1,23 +1,27 @@
|
|||
# My Nix Configurations 💻
|
||||
# NixOS Configuration
|
||||
|
||||
My modular Nix configs 🔥
|
||||
Modular NixOS flake configuration with home-manager integration.
|
||||
|
||||
## Requirements ⚙️
|
||||
## Requirements
|
||||
|
||||
- [Nix 2.0 & Flakes enabled](https://nixos.wiki/wiki/Flakes#Enable_flakes_permanently_in_NixOS)
|
||||
- [Nix with Flakes](https://nixos.wiki/wiki/Flakes#Enable_flakes_permanently_in_NixOS)
|
||||
- [NixOS](https://www.nixos.org/) for system configurations
|
||||
- [Nix Home-Manager](https://nix-community.github.io/home-manager/index.xhtml#sec-flakes-standalone) for user configurations
|
||||
- [Home-Manager](https://nix-community.github.io/home-manager/) for user configurations
|
||||
|
||||
## Flake Endpoints ❄️
|
||||
## Flake Outputs
|
||||
|
||||
NixOS Configurations: `desktop` · `workstation` · `server` (wip) · `vm` · `wsl`
|
||||
| Configuration | Description |
|
||||
|---------------|-------------|
|
||||
| `desktop` | Primary workstation |
|
||||
| `server` | Home server |
|
||||
| `wsl` | Windows Subsystem for Linux |
|
||||
|
||||
## Fresh Install 🚀
|
||||
## Fresh Install
|
||||
|
||||
From the NixOS live installer:
|
||||
|
||||
```bash
|
||||
# Enable flakes (not enabled by default on installer)
|
||||
# Enable flakes
|
||||
echo "experimental-features = nix-command flakes" | sudo tee -a /etc/nix/nix.conf
|
||||
|
||||
# Clone repo
|
||||
|
|
@ -29,117 +33,90 @@ nix develop
|
|||
just install desktop
|
||||
```
|
||||
|
||||
Replace `desktop` with `workstation` or `vm` as needed.
|
||||
|
||||
## Getting Started 🔧
|
||||
## Getting Started
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules git@github.com:itme-brain/nixos.git
|
||||
cd nixos
|
||||
nix develop
|
||||
just
|
||||
```
|
||||
|
||||
Enter the dev shell with `nix develop`, then run `just` to see available project scripts.
|
||||
**Note:** Replace `hardware.nix` in `system/machines/<machine>` with output from `nixos-generate-config` for your hardware.
|
||||
|
||||
Useful resources:
|
||||
- [nixpkgs Packages](https://search.nixos.org/packages) 📦️
|
||||
- [nixpkgs Options](https://search.nixos.org/options?) 🔍️
|
||||
- [Home-Manager Options](https://mipmip.github.io/home-manager-option-search/) ☕️
|
||||
|
||||
⚠️ Be sure to tailor any hardware settings to your own — replace the `hardware.nix` in `src/system/machines/<machine>` with output from `nixos-generate-config`
|
||||
|
||||
## Submodules 🔗
|
||||
|
||||
Standalone portable configurations maintained as separate repos. Each can be cloned independently on any system — NixOS or not.
|
||||
|
||||
| Submodule | Purpose | Repo | Standalone Install |
|
||||
|-----------|---------|------|--------------------|
|
||||
| **nvim** | Full IDE (LSP, treesitter, telescope) | [itme-brain/nvim](https://github.com/itme-brain/nvim) | `git clone git@github.com:itme-brain/nvim.git ~/.config/nvim` |
|
||||
| **vim** | Lightweight editor for headless servers | [itme-brain/vim](https://github.com/itme-brain/vim) | `git clone git@github.com:itme-brain/vim.git ~/.vim` |
|
||||
|
||||
```bash
|
||||
# Update a submodule
|
||||
cd <submodule-path>
|
||||
git add . && git commit -m "your changes" && git push
|
||||
cd /path/to/nixos
|
||||
git add <submodule-path> && git commit -m "Update <name> submodule"
|
||||
|
||||
# Pull submodule updates from remote
|
||||
git submodule update --remote
|
||||
git add <submodule-path> && git commit -m "Update <name> submodule"
|
||||
```
|
||||
|
||||
## Directory Structure 🗂️
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
.
|
||||
├── flake.nix # Flake entrypoint - defines all NixOS configurations
|
||||
├── flake.nix
|
||||
├── flake.lock
|
||||
├── justfile # Project scripts (via `just`)
|
||||
├── system.configs -> src/system/machines/ # Symlink for quick access
|
||||
├── user.configs -> src/user/config/ # Symlink for quick access
|
||||
└── src/
|
||||
├── system/ # System-level (NixOS) configuration
|
||||
│ ├── machines/ # Per-machine NixOS configurations
|
||||
│ │ ├── desktop/ # Desktop config (flake: nixosConfigurations.desktop)
|
||||
│ │ │ ├── default.nix # Machine entry point
|
||||
│ │ │ ├── hardware.nix # Machine-specific hardware config
|
||||
│ │ │ ├── system.nix # System-level settings
|
||||
│ │ │ └── modules/
|
||||
│ │ │ ├── disko/ # Disk partitioning (disko)
|
||||
│ │ │ └── home-manager/ # Home-manager integration + home.nix
|
||||
│ │ ├── workstation/ # Workstation config (same structure as desktop)
|
||||
│ │ ├── server/ # Server config (no disko)
|
||||
│ │ ├── vm/ # VM config
|
||||
│ │ ├── wsl/ # WSL config (includes wsl module)
|
||||
│ │ └── laptop/ # Laptop config (stub)
|
||||
│ └── modules/ # Shared system modules (imported by machines)
|
||||
│ ├── default.nix
|
||||
│ ├── bitcoin/ # Bitcoin node + electrum server
|
||||
│ ├── forgejo/ # Self-hosted Forgejo
|
||||
│ └── nginx/ # Nginx reverse proxy
|
||||
│
|
||||
└── user/ # User-level (home-manager) configuration
|
||||
├── default.nix # User module entry point
|
||||
├── config/ # User identity & settings
|
||||
│ ├── default.nix # Common user variables (username, email, etc.)
|
||||
│ ├── bookmarks/ # Browser bookmarks
|
||||
│ ├── keys/ # Public keys
|
||||
│ │ ├── pgp/ # PGP public keys
|
||||
│ │ └── ssh/ # SSH public keys
|
||||
│ ├── nvim # Symlink to neovim submodule config
|
||||
│ └── vim # Symlink to vim submodule config
|
||||
└── modules/ # Home-manager modules
|
||||
├── bash/ # Shell config (aliases, prompt, bashrc)
|
||||
├── git/ # Git config + helper scripts
|
||||
├── tmux/ # Tmux config
|
||||
├── security/ # Security tools (GPG)
|
||||
├── utils/ # CLI utilities
|
||||
│ └── modules/
|
||||
│ ├── dev/ # Dev tools (penpot, PCB design)
|
||||
│ ├── email/ # Email client (aerc)
|
||||
│ ├── irc/ # IRC client
|
||||
│ ├── neovim/ # Neovim (config is a git submodule)
|
||||
│ └── vim/ # Vim lightweight (config is a git submodule)
|
||||
└── gui/ # GUI applications
|
||||
├── modules/
|
||||
│ ├── alacritty/ # Terminal emulator
|
||||
│ ├── browsers/ # Firefox & Chromium
|
||||
│ ├── corn/ # Corn app
|
||||
│ ├── fun/ # Discord, etc.
|
||||
│ ├── utils/ # GUI utilities
|
||||
│ └── writing/ # Writing tools
|
||||
└── wm/ # Window managers
|
||||
├── hyprland/ # Hyprland (Wayland) + waybar, rofi
|
||||
├── sway/ # Sway (Wayland) + rofi
|
||||
├── i3/ # i3 (X11) + rofi
|
||||
└── shared/ # Shared WM config (mimeapps)
|
||||
├── justfile
|
||||
│
|
||||
├── system/
|
||||
│ ├── keys/ # Machine SSH keys
|
||||
│ │ └── desktop/
|
||||
│ └── machines/
|
||||
│ ├── desktop/
|
||||
│ │ ├── default.nix # Machine entry point
|
||||
│ │ ├── hardware.nix # Hardware config
|
||||
│ │ ├── system.nix # System settings
|
||||
│ │ └── modules/
|
||||
│ │ ├── disko/ # Disk partitioning
|
||||
│ │ └── home-manager/ # Home-manager integration
|
||||
│ ├── server/ # Server (same structure)
|
||||
│ └── wsl/ # WSL (same structure)
|
||||
│
|
||||
└── user/
|
||||
├── default.nix # User options (name, email, keys)
|
||||
├── home.nix # Shared home-manager defaults
|
||||
├── bookmarks/
|
||||
├── keys/
|
||||
│ ├── age/
|
||||
│ ├── pgp/
|
||||
│ └── ssh/
|
||||
└── modules/
|
||||
├── bash/bash/ # Shell (submodule)
|
||||
├── git/git/ # Git (submodule)
|
||||
├── neovim/nvim/ # Neovim (submodule)
|
||||
├── vim/vim/ # Vim (submodule)
|
||||
├── tmux/
|
||||
├── dev/ # CLI dev tools
|
||||
├── security/
|
||||
│ ├── gpg/
|
||||
│ └── yubikey/
|
||||
├── utils/
|
||||
│ ├── dev/ # Dev tools (claude-code, direnv, etc.)
|
||||
│ ├── email/
|
||||
│ ├── irc/
|
||||
│ └── writing/
|
||||
└── gui/
|
||||
├── default.nix # Browser-focused mimeApps
|
||||
├── wm/
|
||||
│ ├── hyprland/
|
||||
│ └── sway/
|
||||
├── browsers/
|
||||
├── alacritty/
|
||||
├── dev/
|
||||
│ ├── pcb/ # Arduino, KiCad
|
||||
│ └── design/ # Penpot
|
||||
├── corn/
|
||||
├── fun/
|
||||
└── utils/
|
||||
```
|
||||
|
||||
### How it works
|
||||
## Architecture
|
||||
|
||||
**flake.nix** defines NixOS configurations (desktop, workstation, server, wsl) that each reference a machine under `src/system/machines/`. Each machine's `default.nix` pulls in its own `hardware.nix`, `system.nix`, and per-machine modules (disko, home-manager).
|
||||
**flake.nix** defines NixOS configurations that reference machines under `system/machines/`.
|
||||
Each machine imports its hardware, system settings, and home-manager config.
|
||||
|
||||
The **system layer** (`src/system/`) handles NixOS-level concerns: hardware, bootloader, networking, and system services. Shared modules in `src/system/modules/` can be imported by any machine.
|
||||
**user/home.nix** provides shared defaults for all users:
|
||||
- Essential packages
|
||||
- Default modules
|
||||
|
||||
The **user layer** (`src/user/`) handles home-manager configuration. `src/user/config/` defines user identity (name, email, keys), while `src/user/modules/` contains modular home-manager configs for individual tools. Each machine's `home-manager/home.nix` selects which user modules to enable.
|
||||
**Machine home.nix** imports user defaults and enables machine-specific modules.
|
||||
|
||||
Root symlinks `system.configs` and `user.configs` provide quick access to machine definitions and user config from the repo root.
|
||||
## Resources
|
||||
|
||||
- [nixpkgs Packages](https://search.nixos.org/packages)
|
||||
- [nixpkgs Options](https://search.nixos.org/options)
|
||||
- [Home-Manager Options](https://home-manager-options.extranix.com)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue