From 3f50049e17a571cb5d46d063d0b02a15aa3cceaa Mon Sep 17 00:00:00 2001 From: Damien Date: Wed, 9 Sep 2026 09:08:13 +0200 Subject: [PATCH] update --- .gitignore | 5 +++++ README.md | 24 +++++++++++++++++------- pxe-server/configuration.nix | 11 +++++++++++ 3 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ac8d589 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# Spécifique à la machine qui héberge le serveur PXE (UUID disque, etc.) +# généré via `nixos-generate-config`, jamais partagé. C'est aussi pour ça +# que le rebuild sur cette machine a besoin de --impure (voir README) : +# un flake pur ne voit que les fichiers suivis par git. +pxe-server/hardware-configuration.nix diff --git a/README.md b/README.md index 92dbad1..4e3437b 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,15 @@ git clone https://gitea.miniclic.net/Damien/Nixos_Fleet.git /etc/nixos-fleet cd /etc/nixos-fleet ``` -## Étape 3 — Éditer 3 valeurs +## Étape 3 — Générer le fichier matériel + +Propre à cette machine, jamais commité (voir `.gitignore`). + +```bash +sudo nixos-generate-config --show-hardware-config > pxe-server/hardware-configuration.nix +``` + +## Étape 4 — Éditer 3 valeurs Fichier : `pxe-server/configuration.nix` @@ -160,13 +168,15 @@ Fichier : `pxe-server/configuration.nix` $EDITOR pxe-server/configuration.nix ``` -## Étape 4 — Construire +## Étape 5 — Construire + +`hardware-configuration.nix` est gitignored, donc invisible à un flake pur → `--impure` obligatoire ici (même raison que `nixos_cinnamon`). ```bash -sudo nixos-rebuild switch --flake .#pxe-server +sudo nixos-rebuild switch --flake .#pxe-server --impure ``` -## Étape 5 — Publier l'image +## Étape 6 — Publier l'image ```bash sudo systemctl start pxe-publish @@ -175,7 +185,7 @@ sudo systemctl status pxe-publish Doit finir en "success". Première fois : plusieurs minutes. -## Étape 6 — Vérifier +## Étape 7 — Vérifier ```bash sudo systemctl status dnsmasq caddy @@ -186,7 +196,7 @@ curl -I http:///netboot.ipxe Tout doit répondre sans erreur. -## Étape 7 — Tester sur 1 PC +## Étape 8 — Tester sur 1 PC Démarrer un seul PC en PXE. @@ -219,7 +229,7 @@ sudo systemctl start pxe-publish Appliquer une modif de `pxe-server/configuration.nix` : ```bash -sudo nixos-rebuild switch --flake .#pxe-server +sudo nixos-rebuild switch --flake .#pxe-server --impure ``` Voir les logs DHCP/TFTP : diff --git a/pxe-server/configuration.nix b/pxe-server/configuration.nix index 7788e1e..869fc82 100644 --- a/pxe-server/configuration.nix +++ b/pxe-server/configuration.nix @@ -25,6 +25,17 @@ let tftpRoot = "/var/lib/tftpboot"; in { + imports = [ + # Généré sur le serveur réel via `nixos-generate-config`, jamais + # committé (voir .gitignore) — spécifique à cette machine. + ./hardware-configuration.nix + ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + # Si le serveur est en BIOS legacy (pas UEFI), remplacer les deux lignes + # au-dessus par boot.loader.grub.device = "/dev/sdX"; + networking.hostName = "pxe-server"; networking.firewall.allowedUDPPorts = [ 67