!oNSIfazDqEcwhcOjSL:matrix.org

disko

352 Members
disko - declarative disk partitioning - https://github.com/nix-community/disko87 Servers

Load older messages


SenderMessageTime
30 Nov 2025
@not-jack:matrix.orgnot-jackso i can get rid of it?14:05:47
@mou_bugtracker:matrix.orgmou

I'm using systemd-boot (no grub) with UEFI, and for this it is enought to have single /boot with ESP like this

          type = "gpt";
          partitions = {
            ESP = {
              type = "EF00";
              size = "2G";
              content = {
                type = "filesystem";
                format = "vfat";
                mountpoint = "/boot";
              };
            };
14:08:25
@mou_bugtracker:matrix.orgmoubut your config mentioned MBR in comments, so it might be different situation for you14:09:13
@not-jack:matrix.orgnot-jackthis is the default config for single disk ext414:10:19
@not-jack:matrix.orgnot-jackso i think we're in the same situation14:11:48
@mou_bugtracker:matrix.orgmouAs i understand logic of the boot process, the important part is decide are you using UEFI. If yes, you have to have GPT partition table (not mbr) and old MBR requirement to have bootloader in first 512K of the drive is no longer reuirement. So this reservation for grub is not needed 14:15:35
@not-jack:matrix.orgnot-jackaha, so it's legacy for backwards compat with grum14:16:46
@not-jack:matrix.orgnot-jack* aha, so it's legacy for backwards compat with grub14:16:48
@mou_bugtracker:matrix.orgmouIt is not grub specific. It is applicable to any bootloader for MBR partitioned drive. All bootloader put their initialization code into first 512K right after partition table14:17:51
@not-jack:matrix.orgnot-jack * aha, so it's legacy for backwards compat with grub MBR 14:19:33
@mou_bugtracker:matrix.orgmouBut i did not refreshed my knowledge in this area for last decade, so i might mix things up. So, if you want to be sure, do additional check.14:19:34
@not-jack:matrix.orgnot-jackthe check will be seeing if i can boot!14:19:50
@mou_bugtracker:matrix.orgmouHere is more in depth explanation of the logic. https://superuser.com/questions/1566558/is-a-boot-sector-considered-to-be-a-partition14:22:28
@not-jack:matrix.orgnot-jackthanks, that helps :)14:26:46
@spewdins:beeper.comspewdins

For those using disko for vm’s disk sizes…

I wonder. Are you declaratively setting your vm .qcow2 for example, from the host system? Or from inside the vm.

17:03:16
@not-jack:matrix.orgnot-jackWhen using disko-install, i get no space left on device19:59:11
@not-jack:matrix.orgnot-jackI've tried remounting the store with more space, but that doesn't seem to do anything 20:00:00
@not-jack:matrix.orgnot-jackAnyone have tips? 20:00:07
@not-jack:matrix.orgnot-jackActually, looks like i'm oom'ing now20:06:19
@chickeniq:matrix.orgChickenIQ joined the room.21:39:45
@chickeniq:matrix.orgChickenIQI've been trying to generate a disk image for my pi 4 with disko, but i keep getting an error: "Firmware not found" Any idea on how i could fix it? Repo: https://github.com/ChickenIQ/NixOSPI421:45:53
@chickeniq:matrix.orgChickenIQ* I've been trying to generate a disk image for my pi 4 with disko, but i keep getting an error on boot: "Firmware not found" Any idea on how i could fix it? Repo: https://github.com/ChickenIQ/NixOSPI421:47:01
1 Dec 2025
@chickeniq:matrix.orgChickenIQ

this seems to be enough to get it to work

          esp = {
            size = "1024M";
            type = "EF00";
            content = {
              format = "vfat";
              type = "filesystem";
              mountpoint = "/boot";
              mountOptions = [ "umask=0077" ];
              postMountHook =
                let
                  configTxt = pkgs.writeText "config.txt" ''
                    [pi4]
                    kernel=u-boot-rpi4.bin
                    disable_overscan=1
                    enable_gic=1
                    arm_boost=1

                    [all]
                    avoid_warnings=1
                    enable_uart=1
                    arm_64bit=1
                  '';
                in
                toString (
                  pkgs.writeScript "postMountHook.sh" ''
                    (cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup4.dat start4.elf bcm2711-*.dtb /mnt/boot/)
                    cp ${pkgs.ubootRaspberryPi4_64bit}/u-boot.bin /mnt/boot/u-boot-rpi4.bin
                    cp ${configTxt} /mnt/boot/config.txt
                  ''
                );
            };
          };
00:20:12
@chickeniq:matrix.orgChickenIQ

proper hack, works without disko too

{
  config,
  pkgs,
  lib,
  ...
}:

let
  installBootLoader =
    (import (pkgs.path + "/nixos/modules/system/boot/loader/generic-extlinux-compatible") {
      inherit config lib pkgs;
    }).config.content.system.build.installBootLoader;

  populateFirmware =
    (import (pkgs.path + "/nixos/modules/installer/sd-card/sd-image-aarch64.nix") {
      inherit config lib pkgs;
    }).sdImage.populateFirmwareCommands;

  installCmd = pkgs.writeShellScript "populate-boot.sh" ''
    set -e && export PATH=${pkgs.coreutils}/bin:$PATH
    ${installBootLoader} "$@"

    ln -s "/boot" "$NIX_BUILD_TOP/firmware" 
    cd "$NIX_BUILD_TOP" && ${populateFirmware} 
    echo "include usercfg.txt" >> /boot/config.txt
  '';
in
{
  system.build.installBootLoader = lib.mkForce installCmd;
}
03:27:03
@chickeniq:matrix.orgChickenIQ *

proper hack, works without disko too

{
  config,
  pkgs,
  lib,
  ...
}:

let
  installBootLoader =
    (import (pkgs.path + "/nixos/modules/system/boot/loader/generic-extlinux-compatible") {
      inherit config lib pkgs;
    }).config.content.system.build.installBootLoader;

  populateFirmware =
    (import (pkgs.path + "/nixos/modules/installer/sd-card/sd-image-aarch64.nix") {
      inherit config lib pkgs;
    }).sdImage.populateFirmwareCommands;

  installCmd = pkgs.writeShellScript "populate-boot.sh" ''
    set -e && export PATH=${pkgs.coreutils}/bin:$PATH
    ${installBootLoader} "$@"

    ln -s "/boot" "$NIX_BUILD_TOP/firmware" 
    cd "$NIX_BUILD_TOP" && ${populateFirmware} 
    echo "include usercfg.txt" >> /boot/config.txt
  '';
in
{
  system.build.installBootLoader = lib.mkForce installCmd;
}
03:27:14
@stooj:matrix.orgstooj joined the room.16:54:37
25 Apr 2024
@zraexy:nixos.devDavid Mell (zraexy) joined the room.23:38:25
@zraexy:nixos.devDavid Mell (zraexy) changed their display name from David Mell to David Mell (zraexy).23:51:57
26 Apr 2024
@raj-magesh:matrix.orgRaj

Couple of questions about NixOS live USBs:

I want to partition my 64 GB USB flash drive into two partitions (FAT32 live USB + ext4 storage), so I used the following disko config:

let
  usb = "/dev/disk/by-id/usb-USB_SanDisk_3.2Gen1_0401a943ae4197a38a6f9070194e9ea2b3fb8dbb7997e05ed1b197c0e28946be4b8f000000000000000000001cf4be6800926418a955810751ab6336-0:0";
in {
  disko.devices = {
    disk = {
      live = {
        type = "disk";
        device = usb;
        content = {
          type = "gpt";
          partitions = {
            ESP = {
              type = "EF00";
              device = "${usb}-part1";
              priority = 0;
              size = "8192M";
              content = {
                type = "filesystem";
                format = "vfat";
              };
            };
            storage = {
              device = "${usb}-part2";
              priority = 1;
              size = "100%";
              content = {
                type = "filesystem";
                format = "ext4";
              };
            };
          };
        };
      };
    };
  };
}

I then copied over the files from the (minimal, non-graphical) NixOS live ISO into partition 1, hoping that the instructions on the Arch wiki would generalize to NixOS, but then my live ISO gets stuck with the following error message:

[...]
Timed out waiting for device /dev/root, trying to mount anyway
mounting /dev/root on /iso...
mount: mounting /dev/root on /mnt-root/iso failed: No such file or directory

An error occurred [...]

How can I use my USB flash drive as both a live USB and as a storage device? I found this relevant Discourse link but there was no resolution to the problem there.

I realize this might not be the best place to ask this, but I figured that folks here would have expertise configuring boot partitions correctly.

02:02:16
@raj-magesh:matrix.orgRaj *

Couple of questions about NixOS live USBs:

I want to partition my 64 GB USB flash drive into two partitions (FAT32 live USB + ext4 storage), so I used the following disko config:

let
  usb = "/dev/disk/by-id/usb-USB_SanDisk_3.2Gen1_0401a943ae4197a38a6f9070194e9ea2b3fb8dbb7997e05ed1b197c0e28946be4b8f000000000000000000001cf4be6800926418a955810751ab6336-0:0";
in {
  disko.devices = {
    disk = {
      live = {
        type = "disk";
        device = usb;
        content = {
          type = "gpt";
          partitions = {
            ESP = {
              type = "EF00";
              device = "${usb}-part1";
              priority = 0;
              size = "8192M";
              content = {
                type = "filesystem";
                format = "vfat";
              };
            };
            storage = {
              device = "${usb}-part2";
              priority = 1;
              size = "100%";
              content = {
                type = "filesystem";
                format = "ext4";
              };
            };
          };
        };
      };
    };
  };
}

I then copied over the files from the (minimal, non-graphical) NixOS live ISO into partition 1, hoping that the instructions on the Arch wiki would generalize to NixOS, but then my live ISO gets stuck with the following error message:

[...]
Timed out waiting for device /dev/root, trying to mount anyway
mounting /dev/root on /iso...
mount: mounting /dev/root on /mnt-root/iso failed: No such file or directory

An error occurred [...]

How can I use my USB flash drive as both a live USB and as a storage device? I found this relevant Discourse link but there was no resolution to the problem there.

I realize this might not be the best place to ask this, but I figured that folks here would have expertise configuring boot partitions correctly.

For reference, the NixOS manual says I should dd the ISO to the disk directly: sudo dd if=<path-to-image> of=/dev/sdX bs=4M conv=fsync

02:12:28

Show newer messages


Back to Room ListRoom Version: 10