Archived
Add Proxmox VM disk-image building; fix disko confirmation bypass
modules/disko/proxmox.nix gains imageSize (20G default) and a per-host imageName (networking.hostName, so every proxmox-* host produces a distinctly named image instead of an identical main.raw). This is the same disko.devices config already used to format a real disk on install, so it's available for every proxmox-* target with no per-host changes needed: nix build .#nixosConfigurations.<host>.config.system.build.diskoImagesScript sudo ./result --build-memory 2048 docs/proxmox-images.md covers building, host-key pre-seeding via disko's --pre-format-files (same host-keys/ workflow as the installer and LXC tarball paths), and the qm import/attach sequence for deploying the result to Proxmox. Also fixes a real bug in auto-install.sh found while testing: the disko confirmation bypass used --yes, which disko's CLI doesn't recognize at all (the actual flag is --yes-wipe-all-disks) — so the "skip confirmation" flag was silently a no-op and the interactive prompt kept appearing regardless. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01La55Nsss8jZ7ZuzUV9mfot
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
_:
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
disko.devices = {
|
||||
@@ -6,6 +6,16 @@ _:
|
||||
type = "disk";
|
||||
device = "/dev/sda";
|
||||
|
||||
# Only used when building a standalone disk image directly (`nix build
|
||||
# .#nixosConfigurations.<host>.config.system.build.diskoImagesScript`)
|
||||
# rather than formatting a real device — see docs/proxmox-images.md.
|
||||
# imageSize sets the .raw file's total size (root's "100%" below fills
|
||||
# whatever's left after ESP + swap within it); imageName keeps each
|
||||
# host's image distinctly named instead of every proxmox-* host
|
||||
# producing an identical "main.raw".
|
||||
imageSize = "20G";
|
||||
imageName = config.networking.hostName;
|
||||
|
||||
content = {
|
||||
type = "gpt";
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
|
||||
if nix eval --refresh --json --extra-experimental-features "flakes nix-command" "''${nix_extra_opts[@]}" "''${FLAKE_BASE_URL}#nixosConfigurations.''${choice}.config.disko.devices.disk.main.device" >/dev/null 2>&1; then
|
||||
disko --mode destroy,format,mount \
|
||||
--flake "''${FLAKE_BASE_URL}#''${choice}" "''${nix_extra_opts[@]}" --yes
|
||||
--flake "''${FLAKE_BASE_URL}#''${choice}" "''${nix_extra_opts[@]}" --yes-wipe-all-disks
|
||||
else
|
||||
# No raw disk to partition — true for every LXC container, which has
|
||||
# no block device visible from inside it, only its already-mounted
|
||||
|
||||
Reference in New Issue
Block a user