Created/update all README.md files.
This commit is contained in:
+3
-2
@@ -57,10 +57,11 @@ nix-instantiate --eval -E 'import ./hosts/machine/configuration.nix {}' # Vérif
|
|||||||
## Instructions Spécifiques (Guidelines)
|
## 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.
|
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.
|
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
|
## 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".
|
- 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).
|
- 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 .
|
- Me signaler si et quand il aura été difficile ou impossible de respecter les instructions fournies dans .ai-rules.md .
|
||||||
|
|||||||
+32
@@ -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 <cmd> # 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 <cmd>` instead of raw commands.
|
||||||
@@ -1,105 +1,97 @@
|
|||||||
# 🏗️ **NixOS Infrastructure Project Canvas**
|
# 🏗️ **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).
|
| Decision | Justification | Impact |
|
||||||
- **Environnement** :
|
| ---------------------------------------------------------| ---------------------------------------------------------------------------------| --------------------------------------------------------|
|
||||||
- Un hyperviseur **Proxmox** actuellement, un deuxième à venir.
|
| **No flakes** | Simplify onboarding and avoid a steep learning curve. | Configuration via `configuration.nix` + `callPackage`. |
|
||||||
- Plusieurs **stations de travail** (ex: `dev-xavier`, `mao-julien`, `bureautique`).
|
| **Modular structure** | Separate configurations by machine type and service. | Clear and maintainable directory tree. |
|
||||||
- **Conteneurs LXC** (sur Proxmox) pour les services d'infrastructure (DNS, Gitea, Bitwarden, etc.) et applicatifs.
|
| **`callPackage` for modules** | Make modules autonomous, portable, and reusable. | Each module is an independent Nix package. |
|
||||||
- **2 utilisateurs principaux** (Xavier, Frida) + utilisateurs système (`root`, `admin`, `guest`).
|
| **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. |
|
||||||
- **Matériel** : ThinkCentre m710q (16 Go RAM, i3) avec **KDE 6.3**.
|
| **`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. |
|
||||||
### **Objectifs**
|
| **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. |
|
||||||
| Objectif | Description | Priorité |
|
| **IPv4, IPv6, VLAN support** | Final target is IPv6-first, or even IPv6-only. | IP plan management to be designed. |
|
||||||
| ------------------------------ | ------------------------------------------------------------------------------------ | -------- |
|
|
||||||
| 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. | ⭐ |
|
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## **🔍 Décisions Clés**
|
## **📂 File Structure**
|
||||||
|
|
||||||
|
### **Git Repository 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**
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
nixos-infra/
|
nixos-infra/
|
||||||
├── configuration.nix # Point d'entrée principal
|
├── configuration.nix # Main entry point
|
||||||
├── README.md
|
├── README.md
|
||||||
│
|
│
|
||||||
├── hosts/ # Configurations par machine
|
├── hosts/ # Machine configurations
|
||||||
│ ├── servers/ # Serveurs (hyperviseurs, VMs, LXCs)
|
│ ├── servers/ # Servers (hypervisors, VMs, LXCs)
|
||||||
│ │ ├── pve01/ # Hyperviseur 1
|
│ │ ├── pve01/ # Hypervisor 1
|
||||||
│ │ │ └── configuration.nix
|
│ │ │ └── configuration.nix
|
||||||
│ │ ├── pve02/ # Hyperviseur 2
|
│ │ ├── pve02/ # Hypervisor 2
|
||||||
│ │ │ └── configuration.nix
|
│ │ │ └── configuration.nix
|
||||||
│ │ ├── dns01/ # Conteneur LXC pour DNS (master)
|
│ │ ├── dns01/ # LXC container for DNS (master)
|
||||||
│ │ │ └── configuration.nix
|
│ │ │ └── configuration.nix
|
||||||
│ │ ├── dns02/ # Conteneur LXC pour DNS (slave)
|
│ │ ├── dns02/ # LXC container for DNS (slave)
|
||||||
│ │ │ └── configuration.nix
|
│ │ │ └── configuration.nix
|
||||||
│ │ ├── gitea01/ # Conteneur LXC pour Gitea
|
│ │ ├── gitea01/ # LXC container for Gitea
|
||||||
│ │ │ └── configuration.nix
|
│ │ │ └── configuration.nix
|
||||||
│ │ └── vaultwarden/ # Conteneur LXC pour Vaultwarden
|
│ │ ├── vaultwarden/ # LXC container for Vaultwarden
|
||||||
│ │ └── configuration.nix
|
│ │ │ └── configuration.nix
|
||||||
│ │ └── rp01/ # Conteneur LXC reverse proxy
|
│ │ └── rp01/ # LXC container for reverse proxy
|
||||||
│ │ └── configuration.nix
|
│ │ └── configuration.nix
|
||||||
│ │
|
│ │
|
||||||
│ └── workstations/ # Stations de travail
|
│ └── workstations/ # Workstations
|
||||||
│ ├── sting/ # Station de Xavier (admin, dev, mao)
|
│ ├── sting/ # Xavier's station (admin, dev, audio)
|
||||||
│ │ └── configuration.nix
|
│ │ └── configuration.nix
|
||||||
│ ├── PC-FRIDA/ # Station de Frida (bureautique)
|
│ ├── PC-FRIDA/ # Frida's station (office)
|
||||||
│ │ └── configuration.nix
|
│ │ └── configuration.nix
|
||||||
│ └── gaia/ # Portable de Xavier (MAO)
|
│ └── gaia/ # Xavier's laptop (audio)
|
||||||
│ └── configuration.nix
|
│ └── configuration.nix
|
||||||
│
|
│
|
||||||
├── modules/ # Modules autonomes
|
├── modules/ # Autonomous modules
|
||||||
│ ├── machine-types/ # Types de machines
|
│ ├── machine-types/ # Machine types
|
||||||
│ │ ├── hypervisor.nix # Module pour hyperviseurs
|
│ │ ├── hypervisor.nix # Module for hypervisors
|
||||||
│ │ ├── vm.nix # Module pour VMs
|
│ │ ├── vm.nix # Module for VMs
|
||||||
│ │ ├── lxc.nix # Module pour conteneurs LXC
|
│ │ ├── lxc.nix # Module for LXC containers
|
||||||
│ │ └── workstation.nix # Module pour stations de travail
|
│ │ └── workstation.nix # Module for workstations
|
||||||
│ │
|
│ │
|
||||||
│ ├── services/ # Services
|
│ ├── services/ # Services
|
||||||
│ │ ├── dns/
|
│ │ ├── dns/
|
||||||
│ │ │ ├── default.nix # Implémentation
|
│ │ │ ├── default.nix # Implementation
|
||||||
│ │ │ └── options.nix # Options exposées
|
│ │ │ └── options.nix # Exposed options
|
||||||
│ │ ├── gitea/
|
│ │ ├── gitea/
|
||||||
│ │ │ └── default.nix
|
│ │ │ └── default.nix
|
||||||
│ │ ├── password-manager/
|
│ │ ├── password-manager/
|
||||||
@@ -108,13 +100,13 @@ nixos-infra/
|
|||||||
│ │ │ └── default.nix
|
│ │ │ └── default.nix
|
||||||
│ │ └── ...
|
│ │ └── ...
|
||||||
│ │
|
│ │
|
||||||
│ └── user-profiles/ # Profils utilisateurs (rôles)
|
│ └── user-profiles/ # User profiles (roles)
|
||||||
│ ├── admin.nix # Profil administrateur
|
│ ├── admin.nix # Administrator profile
|
||||||
│ ├── dev.nix # Profil développeur
|
│ ├── dev.nix # Developer profile
|
||||||
│ ├── mao.nix # Profil MAO
|
│ ├── mao.nix # Audio production profile
|
||||||
│ └── standard.nix # Profil standard
|
│ └── standard.nix # Standard profile
|
||||||
│
|
│
|
||||||
├── users/ # Utilisateurs concrets
|
├── users/ # Specific users
|
||||||
│ ├── root/
|
│ ├── root/
|
||||||
│ │ └── configuration.nix
|
│ │ └── configuration.nix
|
||||||
│ ├── xavier/
|
│ ├── xavier/
|
||||||
@@ -124,15 +116,15 @@ nixos-infra/
|
|||||||
│ └── guest/
|
│ └── guest/
|
||||||
│ └── configuration.nix
|
│ └── configuration.nix
|
||||||
│
|
│
|
||||||
├── scripts/ # Scripts utilitaires
|
├── scripts/ # Utility scripts
|
||||||
│ ├── deploy.sh # Déploiement pour machines existantes
|
│ ├── deploy.sh # Deployment for existing machines
|
||||||
│ ├── create-lxc-nixos.sh # Création de conteneurs LXC sous Proxmox
|
│ ├── create-lxc-nixos.sh # LXC container creation on Proxmox
|
||||||
│ └── initial-configuration.nix # Configuration initiale pour nouveaux conteneurs
|
│ └── initial-configuration.nix # Initial configuration for new containers
|
||||||
│
|
│
|
||||||
├── secrets/ # Secrets (exclus de Git)
|
├── secrets/ # Secrets (excluded from Git)
|
||||||
│ └── .gitignore
|
│ └── .gitignore
|
||||||
│
|
│
|
||||||
└── overlays/ # Overlays pour paquets personnalisés
|
└── overlays/ # Overlays for custom packages
|
||||||
└── custom-pkgs.nix
|
└── 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 |
|
---
|
||||||
| ---------------| ---------------------------------------------------------------| -----------------------------------------| ----------------------------------------------|
|
## **📋 Reference Tables**
|
||||||
| `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. |
|
### **1. Machine List**
|
||||||
| `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. |
|
|
||||||
|
| 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**
|
### **3. User List**
|
||||||
|
| Name | Role | SSH Access |
|
||||||
|
|
||||||
| 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 |
|
|
||||||
| --------| -----------------------| -----------|
|
| --------| -----------------------| -----------|
|
||||||
| root | Superutilisateur | ❌ |
|
| root | Superuser | ❌ |
|
||||||
| xavier | Utilisateur principal | ✅ |
|
| xavier | Main user | ✅ |
|
||||||
| frida | Utilisateur | ✅ |
|
| frida | User | ✅ |
|
||||||
| guest | Invité | ❌ |
|
| guest | Guest | ❌ |
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### **3. Liaisons Utilisateur/Machine/Profil**
|
### **4. User/Machine/Profile Mappings**
|
||||||
|
|
||||||
|
|
||||||
| Utilisateur | Machine | Profils Appliqués | Rôle |
|
| User | Machine | Applied Profiles | Role |
|
||||||
| -------------| ---------| -------------------| --------------------------------|
|
| --------| ----------| ------------------| ------------------------------|
|
||||||
| root | Toutes | - | Superutilisateur |
|
| root | All | - | Superuser |
|
||||||
| xavier | Toutes | `admin` | Développement + administration |
|
| xavier | All | `admin` | Development + administration |
|
||||||
| xavier | sting | `admin`, `dev` | Gestion des hyperviseurs |
|
| xavier | sting | `admin`, `dev` | Hypervisor management |
|
||||||
| frida | marley | `standard` | Développement |
|
| frida | PC-FRIDA | `standard` | Development |
|
||||||
| guest | aucune | `guest` | Utilisateur invité |
|
| 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** :
|
1. **Create the container :**
|
||||||
- Utiliser `create-lxc-nixos.sh` pour créer un conteneur à partir du template NixOS.
|
- Use `create-lxc-nixos.sh` to create a container from the NixOS template.
|
||||||
- Le script installe la configuration initiale (`initial-configuration.nix`).
|
- The script installs the initial configuration (`initial-configuration.nix`).
|
||||||
2. **Déployer la configuration finale** :
|
2. **Deploy the final configuration :**
|
||||||
- Le script `deploy.sh` est exécuté automatiquement pour appliquer la configuration spécifique au conteneur (ex: `hosts/servers/dns01/configuration.nix`).
|
- The `deploy.sh` script is executed automatically to apply the specific configuration to the container (e.g., `hosts/servers/dns01/configuration.nix`).
|
||||||
3. **Mettre à jour** :
|
3. **Update :**
|
||||||
- `git pull` dans `/etc/nixos-infra` + `nixos-rebuild switch`.
|
- `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** :
|
1. **Clone the repository :**
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/xlagraula/nixos-infra.git /etc/nixos-infra
|
git clone https://github.com/xlagraula/nixos-infra.git /etc/nixos-infra
|
||||||
```
|
```
|
||||||
2. **Lier la configuration** :
|
2. **Link the configuration :**
|
||||||
```bash
|
```bash
|
||||||
ln -s /etc/nixos-infra/hosts/workstations/dev-xavier/configuration.nix /etc/nixos/configuration.nix
|
ln -s /etc/nixos-infra/hosts/workstations/dev-xavier/configuration.nix /etc/nixos/configuration.nix
|
||||||
```
|
```
|
||||||
3. **Appliquer la configuration** :
|
3. **Apply the configuration :**
|
||||||
```bash
|
```bash
|
||||||
sudo nixos-rebuild switch
|
sudo nixos-rebuild switch
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## **🔐 Gestion des Secrets**
|
## **🔐 Secret Management**
|
||||||
|
|
||||||
- **Outil** : `agenix` (recommandé) ou `sops-nix`.
|
- **Tool** : `agenix` (recommended) or `sops-nix`.
|
||||||
- **Processus** :
|
- **Process** :
|
||||||
1. Chiffrer les secrets avec `age` :
|
1. Encrypt secrets with `age` :
|
||||||
```bash
|
```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
|
```nix
|
||||||
age.secrets.bitwarden-password = {
|
age.secrets.bitwarden-password = {
|
||||||
path = ./secrets/bitwarden/password.age;
|
path = ./secrets/bitwarden/password.age;
|
||||||
mode = "600";
|
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. | ⬜ | ⭐⭐⭐ |
|
| Test the NixOS LXC template | Verify that the template works under Proxmox. | ⬜ | ⭐⭐⭐ |
|
||||||
| Finaliser `create-lxc-nixos.sh` | Tester la création d'un conteneur LXC. | ⬜ | ⭐⭐⭐ |
|
| Finalize `create-lxc-nixos.sh` | Test the creation of an LXC container. | ⬜ | ⭐⭐⭐ |
|
||||||
| Écrire le module DNS | Module pour le service DNS (Bind). | ⬜ | ⭐⭐⭐ |
|
| Write the DNS module | Module for the DNS service (Bind). | ⬜ | ⭐⭐⭐ |
|
||||||
| Configurer `agenix` | Chiffrer les premiers secrets. | ⬜ | ⭐⭐ |
|
| Configure `agenix` | Encrypt the first secrets. | ⬜ | ⭐⭐ |
|
||||||
| Documenter le processus | `README.md` pour expliquer le déploiement. | ⬜ | ⭐⭐ |
|
| Document the process | `README.md` to explain deployment. | ⬜ | ⭐⭐ |
|
||||||
| Automatiser avec Ansible | Playbook pour créer plusieurs conteneurs. | ⬜ | ⭐ |
|
| Automate with Ansible | Playbook to create multiple containers. | ⬜ | ⭐ |
|
||||||
| Intégrer un CI/CD | Tester les configurations avant déploiement. | ⬜ | ⭐ |
|
| Integrate CI/CD | Test configurations before deployment. | ⬜ | ⭐ |
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## **💡 Notes et Bonnes Pratiques**
|
## **💡 Notes and Best Practices**
|
||||||
|
|
||||||
- **Nommage** :
|
- **Naming** :
|
||||||
- Utilisez des noms explicites pour les machines (ex: `dns01`, `gitea01`).
|
- Use explicit names for machines (e.g., `dns01`, `gitea01`).
|
||||||
- Pour les conteneurs LXC, préférez des noms courts et descriptifs.
|
- For LXC containers, prefer short and descriptive names.
|
||||||
- **Sécurité** :
|
- **Security** :
|
||||||
- Désactivez l'accès root en SSH une fois le déploiement terminé.
|
- Disable root SSH access once deployment is complete.
|
||||||
- Utilisez des clés SSH pour l'authentification.
|
- Use SSH keys for authentication.
|
||||||
- **Maintenance** :
|
- **Maintenance** :
|
||||||
- Mettez à jour régulièrement `nixpkgs` (`nix-channel --update`).
|
- Update `nixpkgs` regularly (`nix-channel --update`).
|
||||||
- Documentez les changements dans le `CHANGELOG.md`.
|
- Document changes in the `CHANGELOG.md`.
|
||||||
- **Sauvegardes** :
|
- **Backups** :
|
||||||
- Sauvegardez les configurations (`/etc/nixos-infra`) et les secrets (`secrets/`).
|
- Backup configurations (`/etc/nixos-infra`) and secrets (`secrets/`).
|
||||||
- Pour les conteneurs LXC sous Proxmox, utilisez les sauvegardes Proxmox.
|
- For LXC containers under Proxmox, use Proxmox backups.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## **📚 Ressources Utiles**
|
## **📚 Useful Resources**
|
||||||
|
|
||||||
- [NixOS Manual](https://nixos.org/manual/)
|
- [NixOS Manual](https://nixos.org/manual/)
|
||||||
- [Nix Flakes (pour référence future)](https://nixos.wiki/wiki/Flakes)
|
- [Nix Flakes (for future reference)](https://nixos.wiki/wiki/Flakes)
|
||||||
- [Agenix pour les secrets](https://github.com/ryantm/agenix)
|
- [Agenix for secrets](https://github.com/ryantm/agenix)
|
||||||
- [Proxmox + LXC Documentation](https://pve.proxmox.com/wiki/Linear_Container)
|
- [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)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -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.
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Servers
|
||||||
|
NixOS configurations for infrastructure servers.
|
||||||
|
Defines service roles (DNS, Gitea, reverse-proxy, Vaultwarden)
|
||||||
|
and hypervisor configurations (Proxmox pve01, pve02).
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Lib
|
||||||
|
Custom Nix utility functions and helpers.
|
||||||
|
Used across the configuration to factorize code.
|
||||||
|
Simplifies data and string manipulation.
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# Modules
|
||||||
|
Reusable NixOS modules for the infrastructure.
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Overlays
|
||||||
|
Custom modifications and extensions to Nixpkgs.
|
||||||
|
Applies patches or version overrides to existing packages.
|
||||||
|
Applied globally across the infrastructure.
|
||||||
@@ -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.
|
||||||
@@ -4,4 +4,5 @@ in
|
|||||||
import (builtins.fetchTarball {
|
import (builtins.fetchTarball {
|
||||||
url = "https://github.com/NixOS/nixpkgs/archive/${spec.rev}.tar.gz";
|
url = "https://github.com/NixOS/nixpkgs/archive/${spec.rev}.tar.gz";
|
||||||
sha256 = spec.sha256;
|
sha256 = spec.sha256;
|
||||||
})
|
}) {}
|
||||||
|
# TODO: add a nixos-infra module
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Scripts
|
||||||
|
Utility scripts for infrastructure management.
|
||||||
|
Covers deployment, LXC container creation, and
|
||||||
|
initial bootstrap of new NixOS machines.
|
||||||
@@ -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.
|
||||||
Generated
+17
@@ -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=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"help": "^3.0.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user