From 2adbe4751d9c5f94a4b3920db97c88191ac5284a Mon Sep 17 00:00:00 2001 From: Xavier Lagraula Date: Wed, 6 May 2026 17:13:19 +0200 Subject: [PATCH] Created/update all README.md files. --- .ai-rules.md | 5 +- .clinerules | 32 +++ README.md | 396 +++++++++++++--------------- nixos-infra/README.md | 5 + nixos-infra/hosts/README.md | 2 + nixos-infra/hosts/servers/README.md | 4 + nixos-infra/lib/README.md | 4 + nixos-infra/modules/README.md | 2 + nixos-infra/overlays/README.md | 4 + nixos-infra/pkgs/README.md | 4 + nixos-infra/pkgs/default.nix | 3 +- nixos-infra/scripts/README.md | 4 + nixos-infra/users/README.md | 4 + package-lock.json | 17 ++ package.json | 5 + 15 files changed, 280 insertions(+), 211 deletions(-) create mode 100644 .clinerules create mode 100644 nixos-infra/hosts/README.md create mode 100644 nixos-infra/hosts/servers/README.md create mode 100644 nixos-infra/lib/README.md create mode 100644 nixos-infra/modules/README.md create mode 100644 nixos-infra/overlays/README.md create mode 100644 nixos-infra/pkgs/README.md create mode 100644 nixos-infra/scripts/README.md create mode 100644 nixos-infra/users/README.md create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.ai-rules.md b/.ai-rules.md index 2eff652..5d76f39 100644 --- a/.ai-rules.md +++ b/.ai-rules.md @@ -57,10 +57,11 @@ nix-instantiate --eval -E 'import ./hosts/machine/configuration.nix {}' # Vérif ## Instructions Spécifiques (Guidelines) 1. Ne **jamais** exposer de mot de passe, de clef API ou tout secret en clair. Utiliser les mécanismes de gestion/protection de secrets appropriés au contexte. 2. Privilégier les clefs SSH pour l'authentification aux systèmes. -3. Signaler les éventuelles incohérences de pratiques au sein du projet ou avec les bonnes pratiques. +3. Limiter les longueurs des lignes à 78 caractères imprimables. +4. Signaler les éventuelles incohérences de pratiques au sein du projet ou avec les bonnes pratiques. ## Préférences de Réponses -- Langue : Français. Le code reste en Anglais. +- Langue : Français. Le code, les commentaires et la documentation restent en Anglais. - Style : Technique, concis, orienté "Infrastructure as Code". - Toujours expliquer brièvement *pourquoi* une option NixOS spécifique a été choisie (référence aux options officielles). - Me signaler si et quand il aura été difficile ou impossible de respecter les instructions fournies dans .ai-rules.md . diff --git a/.clinerules b/.clinerules new file mode 100644 index 0000000..7d6c8af --- /dev/null +++ b/.clinerules @@ -0,0 +1,32 @@ +# RTK - Rust Token Killer (Cline) + +**Usage**: Token-optimized CLI proxy for shell commands. + +## Rule + +Always prefix shell commands with `rtk` to minimize token consumption. + +Examples: + +```bash +rtk git status +rtk cargo test +rtk ls src/ +rtk grep "pattern" src/ +rtk find "*.rs" . +rtk docker ps +rtk gh pr list +``` + +## Meta Commands + +```bash +rtk gain # Show token savings +rtk gain --history # Command history with savings +rtk discover # Find missed RTK opportunities +rtk proxy # Run raw (no filtering, for debugging) +``` + +## Why + +RTK filters and compresses command output before it reaches the LLM context, saving 60-90% tokens on common operations. Always use `rtk ` instead of raw commands. diff --git a/README.md b/README.md index 7789f41..cc942ba 100644 --- a/README.md +++ b/README.md @@ -1,105 +1,97 @@ # 🏗️ **NixOS Infrastructure Project Canvas** -*Projet de gestion centralisée des configurations NixOS pour l'infrastructure de Xavier Lagraula* +*Centralized NixOS configuration management project for Xavier Lagraula's infrastructure* +--- + +## **📌 Context and Objectives** + +- **Scope**: Centralized management of **NixOS** configurations for a complete infrastructure (hypervisors, workstations, LXC containers, services). +- **Environment**: + - One **Proxmox** hypervisor currently, a second one coming soon. + - Several **workstations** (e.g., `dev-xavier`, `mao-julien`, `office`). + - **LXC Containers** (on Proxmox) VE for infrastructure services (DNS, Gitea, Bitwarden, etc.) and applications. + - **2 main users** (Xavier, Frida) + system users (`root`, `admin`, `guest`). +- **Hardware**: ThinkCentre m710q (16 GB RAM, i3) with **KDE 6.3**. + +### **Objectives** + +| Objective | Description | Priority | +| --------------------------------| --------------------------------------------------------------------------------------| ----------| +| Centralize configurations | A single Git repository for all machines. | ⭐⭐⭐ | +| Modularity | Reusable modules for services, machine types, and user profiles. | ⭐⭐⭐ | +| Automation | Scripts to deploy configurations to machines and containers. | ⭐⭐⭐ | +| Security | Secret management with `sops-nix` or `agenix`. | ⭐⭐ | +| Portability | Autonomous modules via `callPackage`. | ⭐⭐ | +| Maintenance | Clear documentation and simplified update processes. | ⭐ | --- -## **📌 Contexte et Objectifs** -### **Contexte** +## **🔍 Key Decisions** -- **Portée** : Gestion centralisée des configurations **NixOS** pour une infrastructure complète (hyperviseurs, stations de travail, conteneurs LXC, services). -- **Environnement** : - - Un hyperviseur **Proxmox** actuellement, un deuxième à venir. - - Plusieurs **stations de travail** (ex: `dev-xavier`, `mao-julien`, `bureautique`). - - **Conteneurs LXC** (sur Proxmox) pour les services d'infrastructure (DNS, Gitea, Bitwarden, etc.) et applicatifs. - - **2 utilisateurs principaux** (Xavier, Frida) + utilisateurs système (`root`, `admin`, `guest`). -- **Matériel** : ThinkCentre m710q (16 Go RAM, i3) avec **KDE 6.3**. - -### **Objectifs** - - -| Objectif | Description | Priorité | -| ------------------------------ | ------------------------------------------------------------------------------------ | -------- | -| Centraliser les configurations | Un dépôt Git unique pour toutes les machines. | ⭐⭐⭐ | -| Modularité | Modules réutilisables pour les services, types de machines, et profils utilisateurs. | ⭐⭐⭐ | -| Automatisation | Scripts pour déployer les configurations sur les machines et conteneurs. | ⭐⭐⭐ | -| Sécurité | Gestion des secrets avec `sops-nix`. | ⭐⭐ | -| Portabilité | Modules autonomes via `callPackage`. | ⭐⭐ | -| Maintenance | Documentation claire et processus de mise à jour simplifiés. | ⭐ | +| Decision | Justification | Impact | +| ---------------------------------------------------------| ---------------------------------------------------------------------------------| --------------------------------------------------------| +| **No flakes** | Simplify onboarding and avoid a steep learning curve. | Configuration via `configuration.nix` + `callPackage`. | +| **Modular structure** | Separate configurations by machine type and service. | Clear and maintainable directory tree. | +| **`callPackage` for modules** | Make modules autonomous, portable, and reusable. | Each module is an independent Nix package. | +| **Separation of `user-profiles/` and `users/`** | Distinguish generic roles (e.g., `admin`) from concrete users (e.g., `xavier`). | Flexibility to apply profiles to multiple users. | +| **`deploy.sh` script** | Automate deployment on existing machines. | Clone/update the repo + `nixos-rebuild switch`. | +| **`create-lxc-nixos.sh` script** | Automate the creation of NixOS LXC containers on Proxmox. | Ready-to-use container with initial configuration. | +| **Initial configuration (`initial-configuration.nix`)** | Prepare an LXC container so it can update itself via Git. | Self-sufficient containers. | +| **Secret management with `agenix`** | Encrypt secrets (passwords, keys) for secure storage. | Enhanced security for sensitive data. | +| **Unprivileged LXC containers (`--unprivileged 0`)** | NixOS requires privileges to function correctly in LXC. | Functional containers with NixOS. | +| **IPv4, IPv6, VLAN support** | Final target is IPv6-first, or even IPv6-only. | IP plan management to be designed. | --- ---- -## **🔍 Décisions Clés** +## **📂 File Structure** - -| Décision | Justification | Impact | -| ----------------------------------------------------------| -----------------------------------------------------------------------------------------| ------------------------------------------------------------------| -| **Pas de flakes** | Simplifier la prise en main et éviter une courbe d'apprentissage abrupte. | Configuration via `configuration.nix` + `callPackage`. | -| **Structure modulaire** | Séparer les configurations par type de machine et service. | Arborescence claire et maintenable. | -| `**callPackage` pour les modules** | Rendre les modules autonomes, portables et réutilisables. | Chaque module est un paquetage Nix indépendant. | -| **Séparation `user-profiles/` et `users/**` | Distinguer les rôles génériques (ex: `admin`) des utilisateurs concrets (ex: `xavier`). | Flexibilité pour appliquer des profils à plusieurs utilisateurs. | -| **Script `deploy.sh**` | Automatiser le déploiement sur les machines existantes. | Clone/mise à jour du dépôt + `nixos-rebuild switch`. | -| **Script `create-lxc-nixos.sh**` | Automatiser la création de conteneurs LXC sous Proxmox. | Conteneur prêt à l'emploi avec configuration initiale. | -| **Configuration initiale (`initial-configuration.nix`)** | Préparer un conteneur LXC pour qu'il puisse se mettre à jour via Git. | Conteneurs auto-suffisants. | -| **Gestion des secrets avec `agenix**` | Chiffrer les secrets (mots de passe, clés) pour un stockage sécurisé. | Sécurité renforcée pour les données sensibles. | -| **Conteneurs LXC non privilégés (`--unprivileged 0`)** | NixOS a besoin de privilèges pour fonctionner correctement. | Conteneurs fonctionnels avec NixOS. | -| **Support IPv4, IPv6, VLANs** | La cible finale est IPv6 first, voire IPv6 only. | Gestion du plan IP à concevoir. | - - ---- - ---- - -## **📂 Arborescences de Fichiers** - -### **Structure du dépôt Git** +### **Git Repository Structure** ```bash nixos-infra/ -├── configuration.nix # Point d'entrée principal +├── configuration.nix # Main entry point ├── README.md │ -├── hosts/ # Configurations par machine -│ ├── servers/ # Serveurs (hyperviseurs, VMs, LXCs) -│ │ ├── pve01/ # Hyperviseur 1 +├── hosts/ # Machine configurations +│ ├── servers/ # Servers (hypervisors, VMs, LXCs) +│ │ ├── pve01/ # Hypervisor 1 │ │ │ └── configuration.nix -│ │ ├── pve02/ # Hyperviseur 2 +│ │ ├── pve02/ # Hypervisor 2 │ │ │ └── configuration.nix -│ │ ├── dns01/ # Conteneur LXC pour DNS (master) +│ │ ├── dns01/ # LXC container for DNS (master) │ │ │ └── configuration.nix -│ │ ├── dns02/ # Conteneur LXC pour DNS (slave) +│ │ ├── dns02/ # LXC container for DNS (slave) │ │ │ └── configuration.nix -│ │ ├── gitea01/ # Conteneur LXC pour Gitea +│ │ ├── gitea01/ # LXC container for Gitea │ │ │ └── configuration.nix -│ │ └── vaultwarden/ # Conteneur LXC pour Vaultwarden -│ │ └── configuration.nix -│ │ └── rp01/ # Conteneur LXC reverse proxy +│ │ ├── vaultwarden/ # LXC container for Vaultwarden +│ │ │ └── configuration.nix +│ │ └── rp01/ # LXC container for reverse proxy │ │ └── configuration.nix │ │ -│ └── workstations/ # Stations de travail -│ ├── sting/ # Station de Xavier (admin, dev, mao) +│ └── workstations/ # Workstations +│ ├── sting/ # Xavier's station (admin, dev, audio) │ │ └── configuration.nix -│ ├── PC-FRIDA/ # Station de Frida (bureautique) +│ ├── PC-FRIDA/ # Frida's station (office) │ │ └── configuration.nix -│ └── gaia/ # Portable de Xavier (MAO) +│ └── gaia/ # Xavier's laptop (audio) │ └── configuration.nix │ -├── modules/ # Modules autonomes -│ ├── machine-types/ # Types de machines -│ │ ├── hypervisor.nix # Module pour hyperviseurs -│ │ ├── vm.nix # Module pour VMs -│ │ ├── lxc.nix # Module pour conteneurs LXC -│ │ └── workstation.nix # Module pour stations de travail +├── modules/ # Autonomous modules +│ ├── machine-types/ # Machine types +│ │ ├── hypervisor.nix # Module for hypervisors +│ │ ├── vm.nix # Module for VMs +│ │ ├── lxc.nix # Module for LXC containers +│ │ └── workstation.nix # Module for workstations │ │ │ ├── services/ # Services │ │ ├── dns/ -│ │ │ ├── default.nix # Implémentation -│ │ │ └── options.nix # Options exposées +│ │ │ ├── default.nix # Implementation +│ │ │ └── options.nix # Exposed options │ │ ├── gitea/ │ │ │ └── default.nix │ │ ├── password-manager/ @@ -108,13 +100,13 @@ nixos-infra/ │ │ │ └── default.nix │ │ └── ... │ │ -│ └── user-profiles/ # Profils utilisateurs (rôles) -│ ├── admin.nix # Profil administrateur -│ ├── dev.nix # Profil développeur -│ ├── mao.nix # Profil MAO -│ └── standard.nix # Profil standard +│ └── user-profiles/ # User profiles (roles) +│ ├── admin.nix # Administrator profile +│ ├── dev.nix # Developer profile +│ ├── mao.nix # Audio production profile +│ └── standard.nix # Standard profile │ -├── users/ # Utilisateurs concrets +├── users/ # Specific users │ ├── root/ │ │ └── configuration.nix │ ├── xavier/ @@ -124,15 +116,15 @@ nixos-infra/ │ └── guest/ │ └── configuration.nix │ -├── scripts/ # Scripts utilitaires -│ ├── deploy.sh # Déploiement pour machines existantes -│ ├── create-lxc-nixos.sh # Création de conteneurs LXC sous Proxmox -│ └── initial-configuration.nix # Configuration initiale pour nouveaux conteneurs +├── scripts/ # Utility scripts +│ ├── deploy.sh # Deployment for existing machines +│ ├── create-lxc-nixos.sh # LXC container creation on Proxmox +│ └── initial-configuration.nix # Initial configuration for new containers │ -├── secrets/ # Secrets (exclus de Git) +├── secrets/ # Secrets (excluded from Git) │ └── .gitignore │ -└── overlays/ # Overlays pour paquets personnalisés +└── overlays/ # Overlays for custom packages └── custom-pkgs.nix ``` @@ -140,193 +132,181 @@ nixos-infra/ --- -## **🖥️ Profils de Machines et Services** +## **🖥️ Machine Profiles and Services** -### **Profils de Machines** +### **Machine Profiles** +| Profile | Description | File | Usage | +| --------------| --------------------------------------------------------------| ----------------------------------------| ---------------------------------------------| +| `hypervisor` | Common configuration for hypervisors (KVM, libvirtd, etc.). | `modules/machine-types/hypervisor.nix` | Proxmox hypervisors. | +| `vm` | Common configuration for virtual machines. | `modules/machine-types/vm.nix` | VMs under Proxmox. | +| `lxc` | Common configuration for LXC containers. | `modules/machine-types/lxc.nix` | LXC containers under Proxmox. | +| `workstation` | Common configuration for workstations. | `modules/machine-types/workstation.nix` | Development, audio production, office stations. | + +| Profile | Description | File | +| ------------| --------------------------------------------------| --------------------------------------| +| `admin` | Administrator access (sudo, service management). | `modules/user-profiles/admin.nix` | +| `dev` | Development environment (tools, permissions). | `modules/user-profiles/dev.nix` | +| `cam` | Computer assisted music (cam). | `modules/user-profiles/cam.nix` | +| `standard` | Standard user profile (basic access). | `modules/user-profiles/standard.nix` | -| Profil | Description | Fichier | Utilisation | -| ---------------| ---------------------------------------------------------------| -----------------------------------------| ----------------------------------------------| -| `hypervisor` | Configuration commune aux hyperviseurs (KVM, libvirtd, etc.). | `modules/machine-types/hypervisor.nix` | Hyperviseurs Proxmox. | -| `vm` | Configuration commune aux machines virtuelles. | `modules/machine-types/vm.nix` | VMs sous Proxmox. | -| `lxc` | Configuration commune aux conteneurs LXC. | `modules/machine-types/lxc.nix` | Conteneurs LXC sous Proxmox. | -| `workstation` | Configuration commune aux stations de travail. | `modules/machine-types/workstation.nix` | Stations de développement, MAO, bureautique. | +--- +## **📋 Reference Tables** + +### **1. Machine List** + + +| Name | Machine Type | Services | IPv4 | IPv6 Token | +| ----------| --------------------| -------------| ------| ------------| +| pve01 | Hypervisor | Proxmox | | | +| pve02 | Hypervisor | Proxmox | | | +| dns01 | LXC Container | DNS | | | +| gitea01 | LXC Container | Gitea | | | +| vault01 | LXC Container | Vaultwarden | | | +| sting | Workstation | | | | +| PC-FRIDA | Workstation | | | | + +--- + +### **2. List of User Profiles** + + +| Name | Role | +| ------------| -------------------| +| `admin` | Superuser | +| `dev` | Developer | +| `standard` | Web & Office | +| `guest` | Guest | --- -### **Profils Utilisateurs** - - -| Profil | Description | Fichier | -| ------------| --------------------------------------------------------| --------------------------------------| -| `admin` | Accès administrateur (sudo, gestion des services). | `modules/user-profiles/admin.nix` | -| `dev` | Environnement de développement (outils, permissions). | `modules/user-profiles/dev.nix` | -| `mao` | Configuration pour la musique assistée par ordinateur. | `modules/user-profiles/mao.nix` | -| `standard` | Profil utilisateur standard (accès basique). | `modules/user-profiles/standard.nix` | - - ---- - -## **📋 Tableaux de Référence** - -### **1. Liste des Machines** - - -| Nom | Type de Machine | Services | IPv4 | Token IPv6 | -| ---------| --------------------| -------------| ------| ------------| -| pve01 | Hyperviseur | Proxmox | | | -| pve02 | Hyperviseur | Proxmox | | | -| dns01 | Conteneur LXC | DNS | | | -| gitea01 | Conteneur LXC | Gitea | | | -| vault01 | Conteneur LXC | Vaultwarden | | | -| sting | Station de travail | | | | -| | | | | | -| | | | | | -| | | | | | -| marley | Station de travail | | | | - - ---- - -### **2. Liste des profils utilisateurs** - - -| Nom | Rôle | -| ---------- | ----------------- | -| `admin` | Superutilisateur | -| `dev` | Développeur | -| `standard` | Web & bureautique | -| `guest` | Invité | - - ---- - -### **3. Liste des Utilisateurs** - - -| Nom | Rôle | Accès SSH | +### **3. User List** +| Name | Role | SSH Access | | --------| -----------------------| -----------| -| root | Superutilisateur | ❌ | -| xavier | Utilisateur principal | ✅ | -| frida | Utilisateur | ✅ | -| guest | Invité | ❌ | +| root | Superuser | ❌ | +| xavier | Main user | ✅ | +| frida | User | ✅ | +| guest | Guest | ❌ | --- -### **3. Liaisons Utilisateur/Machine/Profil** +### **4. User/Machine/Profile Mappings** -| Utilisateur | Machine | Profils Appliqués | Rôle | -| -------------| ---------| -------------------| --------------------------------| -| root | Toutes | - | Superutilisateur | -| xavier | Toutes | `admin` | Développement + administration | -| xavier | sting | `admin`, `dev` | Gestion des hyperviseurs | -| frida | marley | `standard` | Développement | -| guest | aucune | `guest` | Utilisateur invité | +| User | Machine | Applied Profiles | Role | +| --------| ----------| ------------------| ------------------------------| +| root | All | - | Superuser | +| xavier | All | `admin` | Development + administration | +| xavier | sting | `admin`, `dev` | Hypervisor management | +| frida | PC-FRIDA | `standard` | Development | +| guest | None | `guest` | Guest user | +| xavier | sting | `admin`, `dev` | Hypervisor management | +| frida | PC-FRIDA | `standard` | Development | +| guest | None | `guest` | Guest user | + --- --- -## **🔄 Workflow de Déploiement** +## **🔄 Deployment Workflow** -### **Pour les conteneurs LXC (Proxmox)** +### **For LXC containers (Proxmox)** -1. **Créer le conteneur** : - - Utiliser `create-lxc-nixos.sh` pour créer un conteneur à partir du template NixOS. - - Le script installe la configuration initiale (`initial-configuration.nix`). -2. **Déployer la configuration finale** : - - Le script `deploy.sh` est exécuté automatiquement pour appliquer la configuration spécifique au conteneur (ex: `hosts/servers/dns01/configuration.nix`). -3. **Mettre à jour** : - - `git pull` dans `/etc/nixos-infra` + `nixos-rebuild switch`. +1. **Create the container :** + - Use `create-lxc-nixos.sh` to create a container from the NixOS template. + - The script installs the initial configuration (`initial-configuration.nix`). +2. **Deploy the final configuration :** + - The `deploy.sh` script is executed automatically to apply the specific configuration to the container (e.g., `hosts/servers/dns01/configuration.nix`). +3. **Update :** + - `git pull` in `/etc/nixos-infra` + `nixos-rebuild switch`. -### **Pour les stations de travail et hyperviseurs** +### **For workstations and hypervisors** -1. **Cloner le dépôt** : - ```bash - git clone https://github.com/xlagraula/nixos-infra.git /etc/nixos-infra - ``` -2. **Lier la configuration** : - ```bash - ln -s /etc/nixos-infra/hosts/workstations/dev-xavier/configuration.nix /etc/nixos/configuration.nix - ``` -3. **Appliquer la configuration** : - ```bash - sudo nixos-rebuild switch - ``` +1. **Clone the repository :** + ```bash + git clone https://github.com/xlagraula/nixos-infra.git /etc/nixos-infra + ``` +2. **Link the configuration :** + ```bash + ln -s /etc/nixos-infra/hosts/workstations/dev-xavier/configuration.nix /etc/nixos/configuration.nix + ``` +3. **Apply the configuration :** + ```bash + sudo nixos-rebuild switch + ``` --- --- -## **🔐 Gestion des Secrets** +## **🔐 Secret Management** -- **Outil** : `agenix` (recommandé) ou `sops-nix`. -- **Processus** : - 1. Chiffrer les secrets avec `age` : +- **Tool** : `agenix` (recommended) or `sops-nix`. +- **Process** : + 1. Encrypt secrets with `age` : ```bash - echo "mon-secret" | age -r age1... -o secrets/bitwarden/password.age + echo "my-secret" | age -r age1... -o secrets/bitwarden/password.age ``` - 2. Intégrer dans la configuration : + 2. Integrate into the configuration : ```nix age.secrets.bitwarden-password = { path = ./secrets/bitwarden/password.age; mode = "600"; }; ``` - 3. **Ne jamais commiter les secrets en clair** (ajouter `secrets/` à `.gitignore`). + 3. **Never commit secrets in plain text** (add `secrets/` to `.gitignore`). --- --- -## **📅 Feuille de Route** +## **📅 Roadmap** -| Étape | Description | Statut | Priorité | +| Step | Description | Status | Priority | | ------------------------------- | ------------------------------------------------- | ------ | -------- | -| Tester le template LXC NixOS | Vérifier que le template fonctionne sous Proxmox. | ⬜ | ⭐⭐⭐ | -| Finaliser `create-lxc-nixos.sh` | Tester la création d'un conteneur LXC. | ⬜ | ⭐⭐⭐ | -| Écrire le module DNS | Module pour le service DNS (Bind). | ⬜ | ⭐⭐⭐ | -| Configurer `agenix` | Chiffrer les premiers secrets. | ⬜ | ⭐⭐ | -| Documenter le processus | `README.md` pour expliquer le déploiement. | ⬜ | ⭐⭐ | -| Automatiser avec Ansible | Playbook pour créer plusieurs conteneurs. | ⬜ | ⭐ | -| Intégrer un CI/CD | Tester les configurations avant déploiement. | ⬜ | ⭐ | +| Test the NixOS LXC template | Verify that the template works under Proxmox. | ⬜ | ⭐⭐⭐ | +| Finalize `create-lxc-nixos.sh` | Test the creation of an LXC container. | ⬜ | ⭐⭐⭐ | +| Write the DNS module | Module for the DNS service (Bind). | ⬜ | ⭐⭐⭐ | +| Configure `agenix` | Encrypt the first secrets. | ⬜ | ⭐⭐ | +| Document the process | `README.md` to explain deployment. | ⬜ | ⭐⭐ | +| Automate with Ansible | Playbook to create multiple containers. | ⬜ | ⭐ | +| Integrate CI/CD | Test configurations before deployment. | ⬜ | ⭐ | --- --- -## **💡 Notes et Bonnes Pratiques** +## **💡 Notes and Best Practices** -- **Nommage** : - - Utilisez des noms explicites pour les machines (ex: `dns01`, `gitea01`). - - Pour les conteneurs LXC, préférez des noms courts et descriptifs. -- **Sécurité** : - - Désactivez l'accès root en SSH une fois le déploiement terminé. - - Utilisez des clés SSH pour l'authentification. +- **Naming** : + - Use explicit names for machines (e.g., `dns01`, `gitea01`). + - For LXC containers, prefer short and descriptive names. +- **Security** : + - Disable root SSH access once deployment is complete. + - Use SSH keys for authentication. - **Maintenance** : - - Mettez à jour régulièrement `nixpkgs` (`nix-channel --update`). - - Documentez les changements dans le `CHANGELOG.md`. -- **Sauvegardes** : - - Sauvegardez les configurations (`/etc/nixos-infra`) et les secrets (`secrets/`). - - Pour les conteneurs LXC sous Proxmox, utilisez les sauvegardes Proxmox. + - Update `nixpkgs` regularly (`nix-channel --update`). + - Document changes in the `CHANGELOG.md`. +- **Backups** : + - Backup configurations (`/etc/nixos-infra`) and secrets (`secrets/`). + - For LXC containers under Proxmox, use Proxmox backups. --- --- -## **📚 Ressources Utiles** +## **📚 Useful Resources** - [NixOS Manual](https://nixos.org/manual/) -- [Nix Flakes (pour référence future)](https://nixos.wiki/wiki/Flakes) -- [Agenix pour les secrets](https://github.com/ryantm/agenix) +- [Nix Flakes (for future reference)](https://nixos.wiki/wiki/Flakes) +- [Agenix for secrets](https://github.com/ryantm/agenix) - [Proxmox + LXC Documentation](https://pve.proxmox.com/wiki/Linear_Container) -- [Exemple de dépôt NixOS Infrastructure](https://github.com/NixOS/nixos-infrastructure) - ---- +- [Example NixOS Infrastructure Repository](https://github.com/NixOS/nixos-infrastructure) +--- \ No newline at end of file diff --git a/nixos-infra/README.md b/nixos-infra/README.md index e69de29..dd7f505 100644 --- a/nixos-infra/README.md +++ b/nixos-infra/README.md @@ -0,0 +1,5 @@ +# nixos-infra + +Central infrastructure-as-code repository for the NixOS fleet (servers and +workstations). Reproductible deployments via NixOS, agenix for secrets, +Proxmox for hypervision. See `../README.md` for an overview. \ No newline at end of file diff --git a/nixos-infra/hosts/README.md b/nixos-infra/hosts/README.md new file mode 100644 index 0000000..45c020b --- /dev/null +++ b/nixos-infra/hosts/README.md @@ -0,0 +1,2 @@ +# Host definition. +Hosts belong to a machine type defined in `nixos-infra/modules/machine-types` and can either be `servers` running services defined in `nixos-infra/modules/services` or `workstations` used by users to access servcies and run applications depending on their profile. \ No newline at end of file diff --git a/nixos-infra/hosts/servers/README.md b/nixos-infra/hosts/servers/README.md new file mode 100644 index 0000000..7b362b5 --- /dev/null +++ b/nixos-infra/hosts/servers/README.md @@ -0,0 +1,4 @@ +# Servers +NixOS configurations for infrastructure servers. +Defines service roles (DNS, Gitea, reverse-proxy, Vaultwarden) +and hypervisor configurations (Proxmox pve01, pve02). \ No newline at end of file diff --git a/nixos-infra/lib/README.md b/nixos-infra/lib/README.md new file mode 100644 index 0000000..14e6f14 --- /dev/null +++ b/nixos-infra/lib/README.md @@ -0,0 +1,4 @@ +# Lib +Custom Nix utility functions and helpers. +Used across the configuration to factorize code. +Simplifies data and string manipulation. \ No newline at end of file diff --git a/nixos-infra/modules/README.md b/nixos-infra/modules/README.md new file mode 100644 index 0000000..b001121 --- /dev/null +++ b/nixos-infra/modules/README.md @@ -0,0 +1,2 @@ +# Modules +Reusable NixOS modules for the infrastructure. diff --git a/nixos-infra/overlays/README.md b/nixos-infra/overlays/README.md new file mode 100644 index 0000000..bd78723 --- /dev/null +++ b/nixos-infra/overlays/README.md @@ -0,0 +1,4 @@ +# Overlays +Custom modifications and extensions to Nixpkgs. +Applies patches or version overrides to existing packages. +Applied globally across the infrastructure. \ No newline at end of file diff --git a/nixos-infra/pkgs/README.md b/nixos-infra/pkgs/README.md new file mode 100644 index 0000000..3e6f505 --- /dev/null +++ b/nixos-infra/pkgs/README.md @@ -0,0 +1,4 @@ +# Packages +Custom software packages not found in upstream Nixpkgs. +Contains project-specific derivations (default.nix). +Can be referenced via overlays or directly by hosts. \ No newline at end of file diff --git a/nixos-infra/pkgs/default.nix b/nixos-infra/pkgs/default.nix index 435849e..eac1464 100644 --- a/nixos-infra/pkgs/default.nix +++ b/nixos-infra/pkgs/default.nix @@ -4,4 +4,5 @@ in import (builtins.fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/${spec.rev}.tar.gz"; sha256 = spec.sha256; -}) \ No newline at end of file +}) {} +# TODO: add a nixos-infra module \ No newline at end of file diff --git a/nixos-infra/scripts/README.md b/nixos-infra/scripts/README.md new file mode 100644 index 0000000..38ce134 --- /dev/null +++ b/nixos-infra/scripts/README.md @@ -0,0 +1,4 @@ +# Scripts +Utility scripts for infrastructure management. +Covers deployment, LXC container creation, and +initial bootstrap of new NixOS machines. diff --git a/nixos-infra/users/README.md b/nixos-infra/users/README.md new file mode 100644 index 0000000..01ecc47 --- /dev/null +++ b/nixos-infra/users/README.md @@ -0,0 +1,4 @@ +# Users +User account configurations and environment setup. +Manages SSH keys, sudo permissions, and Home Manager dotfiles. +Centralizes access control and admin profiles. \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..8c88a50 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,17 @@ +{ + "name": "nixos-infra", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "help": "^3.0.2" + } + }, + "node_modules/help": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/help/-/help-3.0.2.tgz", + "integrity": "sha512-jDd0MU+9xzvOQRC6CIzdjvb+agCvpzQY/Fp11quDnugDO4QQzh134EsLkRQMvFIJBleFkvnXagHFm4MTefkkpA==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..d280c6d --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "help": "^3.0.2" + } +}