Moved machine-type content to subdirectories. Renamed initial-configuration.nix to intial-lxc-configuration.nix

This commit is contained in:
2026-05-08 23:13:15 +02:00
parent bd41a33bae
commit 4d4ac1487c
16 changed files with 36 additions and 20 deletions
+12 -8
View File
@@ -93,10 +93,14 @@ nixos-infra/
├── modules/ # Autonomous modules ├── modules/ # Autonomous modules
│ ├── machine-types/ # Machine types │ ├── machine-types/ # Machine types
│ │ ├── hypervisor.nix # Module for hypervisors │ │ ├── hypervisor/
│ │ ├── vm.nix # Module for VMs │ │ │ └── default.nix # Module for hypervisors
│ │ ├── lxc.nix # Module for LXC containers │ │ ├── vm/
│ │ └── workstation.nix # Module for workstations │ │ │ └── default.nix # Module for VMs
│ │ ├── lxc/
│ │ │ └── default.nix # Module for LXC containers
│ │ └── workstation/
│ │ └── default.nix # Module for workstations
│ │ │ │
│ ├── services/ # Services │ ├── services/ # Services
│ │ ├── dns/ │ │ ├── dns/
@@ -147,10 +151,10 @@ nixos-infra/
### **Machine Profiles** ### **Machine Profiles**
| Profile | Description | File | Usage | | Profile | Description | File | Usage |
| --------------| --------------------------------------------------------------| ----------------------------------------| ---------------------------------------------| | --------------| --------------------------------------------------------------| ----------------------------------------| ---------------------------------------------|
| `hypervisor` | Common configuration for hypervisors (KVM, libvirtd, etc.). | `modules/machine-types/hypervisor.nix` | Proxmox hypervisors. | | `hypervisor` | Common configuration for hypervisors (KVM, libvirtd, etc.). | `modules/machine-types/hypervisor/default.nix` | Proxmox hypervisors. |
| `vm` | Common configuration for virtual machines. | `modules/machine-types/vm.nix` | VMs under Proxmox. | | `vm` | Common configuration for virtual machines. | `modules/machine-types/vm/default.nix` | VMs under Proxmox. |
| `lxc` | Common configuration for LXC containers. | `modules/machine-types/lxc.nix` | LXC containers under Proxmox. | | `lxc` | Common configuration for LXC containers. | `modules/machine-types/lxc/default.nix` | LXC containers under Proxmox. |
| `workstation` | Common configuration for workstations. | `modules/machine-types/workstation.nix` | Development, audio production, office stations. | | `workstation` | Common configuration for workstations. | `modules/machine-types/workstation/default.nix` | Development, audio production, office stations. |
| Profile | Description | File | | Profile | Description | File |
| ------------| --------------------------------------------------| --------------------------------------| | ------------| --------------------------------------------------| --------------------------------------|
@@ -3,7 +3,7 @@
{ {
imports = [ imports = [
# Module for LXC containers # Module for LXC containers
../../../modules/machine-types/lxc.nix ../../../modules/machine-types/lxc
]; ];
# Explicitly enable LXC machine type # Explicitly enable LXC machine type
@@ -3,7 +3,7 @@
{ {
imports = [ imports = [
# Module for LXC containers # Module for LXC containers
../../../modules/machine-types/lxc.nix ../../../modules/machine-types/lxc
]; ];
# Explicitly enable LXC machine type # Explicitly enable LXC machine type
@@ -3,7 +3,7 @@
{ {
imports = [ imports = [
# Module for LXC containers # Module for LXC containers
../../../modules/machine-types/lxc.nix ../../../modules/machine-types/lxc
# Module for the git forge service # Module for the git forge service
../../../modules/services/git-forge/default.nix ../../../modules/services/git-forge/default.nix
]; ];
@@ -3,7 +3,7 @@
{ {
imports = [ imports = [
# Module for LXC containers # Module for LXC containers
../../../modules/machine-types/lxc.nix ../../../modules/machine-types/lxc
# Module for password manager service # Module for password manager service
../../../modules/services/password-manager/default.nix ../../../modules/services/password-manager/default.nix
]; ];
@@ -3,7 +3,7 @@
{ {
imports = [ imports = [
# Module for LXC containers # Module for LXC containers
../../../modules/machine-types/lxc.nix ../../../modules/machine-types/lxc
# Module for the reverse proxy # Module for the reverse proxy
../../../modules/services/reverse-proxy/default.nix ../../../modules/services/reverse-proxy/default.nix
]; ];
@@ -0,0 +1,4 @@
{ config, pkgs, lib, ... }:
{
# TODO: Add hypervisor-specific configuration
}
@@ -0,0 +1,4 @@
{ config, pkgs, lib, ... }:
{
# TODO: Add VM-specific configuration
}
@@ -0,0 +1,4 @@
{ config, pkgs, lib, ... }:
{
# TODO: Add workstation-specific configuration
}
+3 -3
View File
@@ -30,7 +30,7 @@ to apply the host-specific configuration.
1. `pct create` — create the container from the NixOS template 1. `pct create` — create the container from the NixOS template
2. `pct start <CT_ID>` — start the container 2. `pct start <CT_ID>` — start the container
3. Wait for the container to be ready (polling `pct exec`) 3. Wait for the container to be ready (polling `pct exec`)
4. `pct push initial-configuration.nix``/etc/nixos/configuration.nix` 4. `pct push initial-lxc-configuration.nix``/etc/nixos/configuration.nix`
5. `pct push deploy.sh``/usr/local/bin/deploy-nixos` 5. `pct push deploy.sh``/usr/local/bin/deploy-nixos`
6. `pct exec nixos-rebuild switch` — apply initial config (SSH, git, curl) 6. `pct exec nixos-rebuild switch` — apply initial config (SSH, git, curl)
7. `pct exec deploy-nixos` — clone repo and apply host-specific config 7. `pct exec deploy-nixos` — clone repo and apply host-specific config
@@ -56,7 +56,7 @@ finds the corresponding configuration file, and applies it with
1. `hosts/servers/<hostname>/configuration.nix` 1. `hosts/servers/<hostname>/configuration.nix`
2. `hosts/workstations/<hostname>/configuration.nix` 2. `hosts/workstations/<hostname>/configuration.nix`
### `initial-configuration.nix` — Bootstrap NixOS configuration ### `initial-lxc-configuration.nix` — Bootstrap NixOS configuration (LXC)
Minimal NixOS configuration pushed to a new LXC container during the Minimal NixOS configuration pushed to a new LXC container during the
bootstrap phase. Installs SSH, git, and curl so the container can bootstrap phase. Installs SSH, git, and curl so the container can
@@ -93,7 +93,7 @@ Updates `pkgs/nixpkgs.json` with the latest commit from nixpkgs stable.
``` ```
create-lxc-nixos.sh # Step 1: Create + bootstrap create-lxc-nixos.sh # Step 1: Create + bootstrap
└─ pct create └─ pct create
└─ pct push initial-configuration.nix └─ pct push initial-lxc-configuration.nix
└─ pct push deploy.sh └─ pct push deploy.sh
└─ pct exec nixos-rebuild switch └─ pct exec nixos-rebuild switch
└─ pct exec deploy.sh # Step 2: Clone repo + apply config └─ pct exec deploy.sh # Step 2: Clone repo + apply config
+3 -3
View File
@@ -38,7 +38,7 @@ Options:
--pve-port PORT SSH port for Proxmox (default: 22). --pve-port PORT SSH port for Proxmox (default: 22).
--pve-ssh-key KEY SSH key file for authentication. --pve-ssh-key KEY SSH key file for authentication.
--initial-config FILE Initial NixOS configuration file to push --initial-config FILE Initial NixOS configuration file to push
[default: ./initial-configuration.nix]. [default: ./initial-lxc-configuration.nix].
--repo-url URL Git repository URL for deploy.sh --repo-url URL Git repository URL for deploy.sh
[default: https://gitea.lagraula.fr/xavier/nixos-infra.git]. [default: https://gitea.lagraula.fr/xavier/nixos-infra.git].
--branch BRANCH Git branch for deploy.sh [default: main]. --branch BRANCH Git branch for deploy.sh [default: main].
@@ -77,7 +77,7 @@ TAGS="${TAGS:-}"
SSH_PUBLIC_KEYS="${SSH_PUBLIC_KEYS:-}" SSH_PUBLIC_KEYS="${SSH_PUBLIC_KEYS:-}"
# Bootstrap # Bootstrap
INITIAL_CONFIG="${INITIAL_CONFIG:-./initial-configuration.nix}" INITIAL_CONFIG="${INITIAL_CONFIG:-./initial-lxc-configuration.nix}"
REPO_URL="${REPO_URL:-https://gitea.lagraula.fr/xavier/nixos-infra.git}" REPO_URL="${REPO_URL:-https://gitea.lagraula.fr/xavier/nixos-infra.git}"
BRANCH="${BRANCH:-main}" BRANCH="${BRANCH:-main}"
SKIP_DEPLOY="${SKIP_DEPLOY:-false}" SKIP_DEPLOY="${SKIP_DEPLOY:-false}"
@@ -279,7 +279,7 @@ for i in $(seq 1 30); do
sleep 2 sleep 2
done done
# 3. Push initial-configuration.nix # 3. Push initial-lxc-configuration.nix
echo "📄 Pushing initial NixOS configuration..." echo "📄 Pushing initial NixOS configuration..."
run_proxmox "pct push $LXC_ID '$INITIAL_CONFIG' /etc/nixos/configuration.nix" || { run_proxmox "pct push $LXC_ID '$INITIAL_CONFIG' /etc/nixos/configuration.nix" || {
echo "❌ Error: Failed to push initial configuration." >&2 echo "❌ Error: Failed to push initial configuration." >&2