!oNSIfazDqEcwhcOjSL:matrix.org

disko

429 Members
disko - declarative disk partitioning - https://github.com/nix-community/disko117 Servers

Load older messages


SenderMessageTime
16 May 2026
@sofushl:matrix.orgSofus Lind joined the room.22:58:54
@sofushl:matrix.orgSofus LindHow do i / can i use disko to only manage one specific partiiton? I have a 4 partitions 1 is boot, 2 + 3 is windows, and 4 is the partiiton i want to manage in disko, so that i can declaratively setup nixos with preservation. 23:02:05
17 May 2026
@mrvandalo:tiwag.xyzpalo joined the room.08:40:32
@mrvandalo:terranix.org@mrvandalo:terranix.org left the room.08:40:37
18 May 2026
@not-jack:matrix.orgnot-jackDoes anyone know why my root filesystem is not being imported with zfs?10:16:23
@not-jack:matrix.orgnot-jackimage.png
Download image.png
10:16:36
@not-jack:matrix.orgnot-jacki'm getting this: 10:16:37
@magic_rb:matrix.redalder.orgmagic_rbEnable emergency access and check the logs10:21:44
@enzime:nixos.devEnzime could be due to boot.zfs.forceImportRoot changing default value, what stateVersion is your NixOS? 11:08:34
@enzime:nixos.devEnzimehttps://github.com/NixOS/nixpkgs/pull/49558111:09:27
@not-jack:matrix.orgnot-jackdeploying a new image now :)11:10:07
@not-jack:matrix.orgnot-jacktested with forceImportRoot set to true, didn't work11:10:25
@mdietrich:matrix.orgmdietrich joined the room.14:43:28
@mdietrich:matrix.orgmdietrich Can I get a vmWithDisko type setup, but with the impure --extra-files of disko-install or --post-format-files of diskoImagesScript? I've tried for days to get the diskoImagesScript working instead of diskoImages by overriding the system.build.vmWithDisko script, but could not get it to work. 14:58:49
@thou.vow:matrix.org@thou.vow:matrix.org left the room.22:36:02
@mdietrich:matrix.orgmdietrich

I've cooked something up which does what I want:

let
 vmVariantModule =
    {
      config,
      pkgs,
      lib,
      ...
    }:
    let

      ovmf = pkgs.OVMF.override { secureBoot = false; };
    in
    {

      config.system.build.vmWithDiskoSecrets = (
        pkgs.writers.writeBashBin "disko-vm"
          {
            makeWrapperArgs = [
              "--prefix"
              "PATH"
              ":"
              "${lib.makeBinPath [
                pkgs.qemu_kvm
                pkgs.coreutils
              ]}"
            ];
          }
          ''
            set -efux

            # ---------- argument handling ----------
            usage() {
              echo "Usage: $0 --keyfile <path> [--boot-location <dest>] [--mem 4G] [--smp 2]"
              echo ""
              echo "  --keyfile        Path to the keyfile to inject (required)"
              echo "  --boot-location  Destination path inside the image (default: /run/secret)"
              echo "  --mem            QEMU RAM (default: 4G)"
              echo "  --smp            QEMU vCPUs (default: 2)"
              exit 1
            }

            KEYFILE=""
            BOOT_LOCATION="/run/secret"
            MEM="4G"
            SMP="2"

            while [[ $# -gt 0 ]]; do
              case "$1" in
                --keyfile)        KEYFILE="$2";        shift 2 ;;
                --boot-location)  BOOT_LOCATION="$2";  shift 2 ;;
                --mem)            MEM="$2";             shift 2 ;;
                --smp)            SMP="$2";             shift 2 ;;
                *)                usage ;;
              esac
            done

            if [[ -z "$KEYFILE" ]]; then
              echo "Error: --keyfile is required."
              usage
            fi

            # ---------- build image ----------
            WORKDIR=$(mktemp -d /tmp/vm-XXXXXX)
            trap 'rm -rf "$WORKDIR"' EXIT

            echo "[vm-disko] Building disko image in $WORKDIR …"
            # diskoImagesScript writes <hostName>.raw (or similar) into the cwd.
            pushd "$WORKDIR" > /dev/null
            ${config.system.build.diskoImagesScript} --post-format-files "$KEYFILE" "$BOOT_LOCATION"
            popd > /dev/null

            # Find the raw image produced (disko names it after the disk label,
            # so we just grab the first .raw file in the workdir).
            IMAGE=$(find "$WORKDIR" -maxdepth 1 -name '*.raw' | head -n1)
            if [[ -z "$IMAGE" ]]; then
              echo "Error: no .raw image found after diskoImagesScript."
              exit 1
            fi

            echo "[vm-disko] Booting $IMAGE …"

            # ---------- boot in QEMU ----------
            exec qemu-system-x86_64 \
              -enable-kvm \
              -m "$MEM" \
              -cpu max \
              -smp "$SMP" \
              -netdev user,id=net0,hostfwd=tcp::2222-:22 \
              -device virtio-net-pci,netdev=net0 \
              -drive if=pflash,format=raw,readonly=on,file=${ovmf.firmware} \
              -drive if=pflash,format=raw,readonly=on,file=${ovmf.variables} \
              -drive "if=virtio,format=raw,file=$IMAGE" \
              "$@"
          ''
      );
    };
    vmVariantWithDiskoSecrets = extendModules {
          modules = [
            vmVariantModule
          ];
        };
      in
      {
        options.virtualisation.vmVariantWithDiskoSecrets = lib.mkOption {
          description = ''
            Machine configuration to be added for the vm script available at `.system.build.vmWithDiskoSecrets`.
          '';
          inherit (vmVariantWithDiskoSecrets) type;
          default = { };
          visible = "shallow";
        };
        config.system.build.vmWithDiskoSecrets = lib.mkDefault config.virtualisation.vmVariantWithDiskoSecrets.system.build.vmWithDiskoSecrets;
      };
22:55:31
19 May 2026
@todoqki:matrix.orgtodo joined the room.15:41:09
@amadaluzia:4d2.orgamadaluzia changed their profile picture.20:58:32
20 May 2026
@interru:is-a-cute.oneinterru joined the room.20:02:52
21 May 2026
@pascal.sthamer:matrix.procyde.onlinePascal Sthamer changed their profile picture.09:31:11
@pascal.sthamer:matrix.procyde.onlinePascal Sthamer changed their profile picture.09:32:36
@mdietrich:matrix.orgmdietrich Actually having another question: I can install my custom aarch64-linux system on an USB stick for Raspberry Pi usage with disko-install (using the PR #1190), but trying to create the image by using either diskoImages or diskoImagesScript does not work and fails due to virtiofs problems. Anyone hit that also and can help here? 21:17:53
22 May 2026
@jonhermansen:matrix.orgJon Hermansen changed their display name from jonhermansen to Jon Hermansen.19:18:46
23 May 2026
@mtmn:matrix.orgmtmn joined the room.15:23:04
24 May 2026
@nephesh:matrix.orgnephesh joined the room.00:18:54
@nephesh:matrix.orgnephesh set a profile picture.04:33:34
26 May 2026
@nam3l33ss:matrix.org·☽•Nameless☆•777 · ± changed their profile picture.05:42:06
27 May 2026
@barnett:kebado.netBarnett joined the room.08:27:00
@barnett:kebado.netBarnett changed their display name from Barnett Trzcinski 💕 to Barnett.08:27:57
@barnett:kebado.netBarnett set a profile picture.08:59:07

Show newer messages


Back to Room ListRoom Version: 10