Drop disko: use direct sgdisk+mkfs+mount in installer, remove disko package and disko.nix

Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/3dbc739b-c3da-432d-b070-16217e58c76b

Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-05 15:40:42 +00:00
committed by GitHub
parent 53a0010e47
commit cb7b097ce0
3 changed files with 42 additions and 74 deletions

View File

@@ -55,7 +55,6 @@ in
gsettings-desktop-schemas gsettings-desktop-schemas
adwaita-icon-theme adwaita-icon-theme
util-linux util-linux
disko
parted parted
dosfstools dosfstools
e2fsprogs e2fsprogs

View File

@@ -1,59 +0,0 @@
{ device ? "/dev/sda", dataDevice ? "", ... }:
{
disko.devices = {
disk = {
main = {
type = "disk";
device = builtins.toString device;
content = {
type = "gpt";
partitions = {
ESP = {
priority = 1;
name = "ESP";
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot/efi";
mountOptions = [ "umask=0077" "defaults" ];
};
};
root = {
name = "root";
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
extraArgs = [ "-L" "sovran_systemsos" ];
};
};
};
};
};
} // (if dataDevice != "" then {
data = {
type = "disk";
device = builtins.toString dataDevice;
content = {
type = "gpt";
partitions = {
primary = {
name = "primary";
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/run/media/Second_Drive";
extraArgs = [ "-L" "BTCEcoandBackup" ];
};
};
};
};
};
} else {});
};
}

View File

@@ -710,7 +710,7 @@ class InstallerWindow(Adw.ApplicationWindow):
boot_path = f"/dev/{self.boot_disk}" boot_path = f"/dev/{self.boot_disk}"
data_path = f"/dev/{self.data_disk}" if self.data_disk else None data_path = f"/dev/{self.data_disk}" if self.data_disk else None
# ── Wipe disk(s) to clear stale GPT/MBR data before disko ── # ── Wipe disk(s) ──
GLib.idle_add(append_text, buf, "=== Wiping disk(s) ===\n") GLib.idle_add(append_text, buf, "=== Wiping disk(s) ===\n")
run_stream(["sudo", "sgdisk", "--zap-all", boot_path], buf) run_stream(["sudo", "sgdisk", "--zap-all", boot_path], buf)
@@ -720,26 +720,54 @@ class InstallerWindow(Adw.ApplicationWindow):
run_stream(["sudo", "sgdisk", "--zap-all", data_path], buf) run_stream(["sudo", "sgdisk", "--zap-all", data_path], buf)
run_stream(["sudo", "wipefs", "--all", "--force", data_path], buf) run_stream(["sudo", "wipefs", "--all", "--force", data_path], buf)
# Inform the kernel of the wiped partition tables
run_stream(["sudo", "partprobe", boot_path], buf) run_stream(["sudo", "partprobe", boot_path], buf)
if data_path: if data_path:
run_stream(["sudo", "partprobe", data_path], buf) run_stream(["sudo", "partprobe", data_path], buf)
# Short settle so the kernel finishes re-reading
time.sleep(2) time.sleep(2)
# ── Now run disko to partition, format, and mount ── # ── Partition boot disk: 512M ESP + rest as root ──
# Disks are already wiped clean by sgdisk/wipefs above, GLib.idle_add(append_text, buf, "\n=== Partitioning boot disk ===\n")
# so we only need disko to create partitions, format, and mount. run_stream(["sudo", "sgdisk",
GLib.idle_add(append_text, buf, "\n=== Partitioning and formatting drives ===\n") "-n", "1:1M:+512M", "-t", "1:EF00", "-c", "1:ESP",
cmd = [ "-n", "2:0:0", "-t", "2:8300", "-c", "2:root",
"sudo", "disko", "--mode", "format,mount", boot_path], buf)
f"{FLAKE}/iso/disko.nix",
"--arg", "device", boot_path run_stream(["sudo", "partprobe", boot_path], buf)
] time.sleep(2)
# ── Partition data disk (if selected) ──
if data_path: if data_path:
cmd += ["--arg", "dataDevice", data_path] GLib.idle_add(append_text, buf, "\n=== Partitioning data disk ===\n")
run_stream(cmd, buf) run_stream(["sudo", "sgdisk",
"-n", "1:1M:0", "-t", "1:8300", "-c", "1:primary",
data_path], buf)
run_stream(["sudo", "partprobe", data_path], buf)
time.sleep(2)
# ── Format partitions ──
GLib.idle_add(append_text, buf, "\n=== Formatting partitions ===\n")
boot_p1 = f"{boot_path}p1" if "nvme" in boot_path else f"{boot_path}1"
boot_p2 = f"{boot_path}p2" if "nvme" in boot_path else f"{boot_path}2"
run_stream(["sudo", "mkfs.vfat", "-F", "32", boot_p1], buf)
run_stream(["sudo", "mkfs.ext4", "-F", "-L", "sovran_systemsos", boot_p2], buf)
if data_path:
data_p1 = f"{data_path}p1" if "nvme" in data_path else f"{data_path}1"
run_stream(["sudo", "mkfs.ext4", "-F", "-L", "BTCEcoandBackup", data_p1], buf)
# ── Mount filesystems ──
GLib.idle_add(append_text, buf, "\n=== Mounting filesystems ===\n")
run_stream(["sudo", "mount", boot_p2, "/mnt"], buf)
run_stream(["sudo", "mkdir", "-p", "/mnt/boot/efi"], buf)
run_stream(["sudo", "mount", "-o", "umask=0077,defaults", boot_p1, "/mnt/boot/efi"], buf)
if data_path:
data_p1 = f"{data_path}p1" if "nvme" in data_path else f"{data_path}1"
run_stream(["sudo", "mkdir", "-p", "/mnt/run/media/Second_Drive"], buf)
run_stream(["sudo", "mount", data_p1, "/mnt/run/media/Second_Drive"], buf)
GLib.idle_add(append_text, buf, "\n=== Generating hardware config ===\n") GLib.idle_add(append_text, buf, "\n=== Generating hardware config ===\n")
run_stream(["sudo", "nixos-generate-config", "--root", "/mnt"], buf) run_stream(["sudo", "nixos-generate-config", "--root", "/mnt"], buf)