|
|
|
@@ -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,120 +132,109 @@ 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** :
|
|
|
|
|
1. **Clone the repository :**
|
|
|
|
|
```bash
|
|
|
|
|
git clone https://github.com/xlagraula/nixos-infra.git /etc/nixos-infra
|
|
|
|
|
```
|
|
|
|
|
2. **Lier la configuration** :
|
|
|
|
|
2. **Link the configuration :**
|
|
|
|
|
```bash
|
|
|
|
|
ln -s /etc/nixos-infra/hosts/workstations/dev-xavier/configuration.nix /etc/nixos/configuration.nix
|
|
|
|
|
```
|
|
|
|
|
3. **Appliquer la configuration** :
|
|
|
|
|
3. **Apply the configuration :**
|
|
|
|
|
```bash
|
|
|
|
|
sudo nixos-rebuild switch
|
|
|
|
|
```
|
|
|
|
@@ -262,71 +243,70 @@ nixos-infra/
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## **🔐 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)
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|