!oNSIfazDqEcwhcOjSL:matrix.org

disko

353 Members
disko - declarative disk partitioning - https://github.com/nix-community/disko88 Servers

Load older messages


SenderMessageTime
2 Aug 2024
@fiioul:matrix.orgfiioul joined the room.19:38:14
5 Aug 2024
@rypervenche:matrix.orgrypervencheIs it possible to create a configuration using BTRFS RAID1?23:40:25
6 Aug 2024
@sigmasquadron:matrix.orgSigmaSquadronbold choice to use BTRFS' RAID system.01:43:12
@rypervenche:matrix.orgrypervenche
In reply to @sigmasquadron:matrix.org
bold choice to use BTRFS' RAID system.
I've been using it for years. 0 problems. I don't use RAID5/6 though, which are the problematic ones
15:07:00
7 Aug 2024
@eyjhb:eyjhb.dkeyJhbIf I add a new ZFS dataset, will Disko automatically create that? I assume no19:25:45
8 Aug 2024
@eyjhb:eyjhb.dkeyJhb

Trying to setup LUKS+ZFS with Disko, I get prompted for my password, but right after I get this error.

/nix/store/ix2hsx2myrkpiw6gs8i06nbgjp49zdik-disko/bin/disko: line 128: cryptsetup: command not found

11:30:57
@lassulus:lassul.uslassulushuh11:32:16
@lassulus:lassul.uslassulusit should be created if you run the formatScript again, but that can also be a bit dangerous as it a relatively new feature 11:32:48
@lassulus:lassul.uslassuluswhat did you try to run to get that error?11:33:18
@eyjhb:eyjhb.dkeyJhb
    NIX_TOP_LEVEL_PATH=$(nix build --impure -I nixos-config=./machines/gerd.nix --json --expr "(import <nixpkgs/nixos> {}).config.system.build.toplevel" | jq -r '.[].outputs.out')
    NIX_DISKO_SCRIPT=$(nix build --impure -I nixos-config=./machines/gerd.nix --json --expr "(import <nixpkgs/nixos> {}).config.system.build.diskoScriptNoDeps" | jq -r '.[].outputs.out')

    nixos-anywhere --store-paths "$NIX_DISKO_SCRIPT" "$NIX_TOP_LEVEL_PATH" "$USERNAME@$IP"

Works just fine without LUKS.

{ lib, ... }:

let
  makeZFSDatasets = datasets: (lib.mapAttrs' (n: v: lib.nameValuePair v.dataset ({
      type = "zfs_fs";
      mountpoint = n;
      options.mountpoint = "legacy";
  } // (if v ? extra then v.extra else {}))) datasets);
in {
  disko.devices = {
    disk.disk1 = {
      type = "disk";
      device = lib.mkDefault "/dev/sda";
      content = {
        type = "gpt";
        partitions = {
          boot = {
            name = "boot";
            size = "1M";
            type = "EF02";
          };
          esp = {
            name = "ESP";
            size = "500M";
            type = "EF00";
            content = {
              type = "filesystem";
              format = "vfat";
              mountpoint = "/boot";
            };
          };

          luks = {
            size = "100%";
            content = {
              type = "luks";
              name = "cryptroot";
              settings.allowDiscards = true;
              # passwordFile = "/tmp/luks.pass";

              content = {
                type = "zfs";
                pool = "rpool";
              };
            };
          };
        };
      };
    };

    zpool = {
      rpool = {
        type = "zpool";
        # rootFsOptions.compression = "zstd";
        rootFsOptions = {
          compression = "on";
          atime = "off";
          acltype = "posixacl";
          xattr = "sa";

          # test
          # "com.sun:auto-snapshot" = "false";
          # "com.klarasystems:vdev_zaps_v2" = "false";
        };

        datasets = let
          baseDatasets = {
            "/" = { dataset = "root"; extra = { postCreateHook = "zfs snapshot rpool/root@blank"; }; };
            "/nix".dataset = "local/nix";
            "/state/stash".dataset = "local/stash";
            "/state/home".dataset = "safe/home";
            "/state/root".dataset = "safe/persistent";

            # extra datasets
            "/srv/forgejo" = { dataset = "safe/svcs/forgejo"; extra.options.quota = "5G"; };
          };
        in (makeZFSDatasets baseDatasets);
      };
    };
  };
}
11:34:16
@lassulus:lassul.uslassuluswhy the nodeps output? the normal output would put cryptsetup into PATH11:34:54
@eyjhb:eyjhb.dkeyJhbI seem to remember I yanked it from some manual.11:35:59
@eyjhb:eyjhb.dkeyJhbBut, that might be me misremembering.11:36:08
@eyjhb:eyjhb.dkeyJhbI've changed it away from nodeps now :)11:37:00
@eyjhb:eyjhb.dkeyJhb Yeah, seems to work now. Thanks for solving me being stupid lassulus ! 11:37:32
@eyjhb:eyjhb.dkeyJhb Also, I had to reread the nodeps a couple of times, my mind couldn't understand what NODE ps was, and why node was relevant. 11:38:12
@lassulus:lassul.uslassulus:D maybe I should have written NoDeps11:40:21
@eyjhb:eyjhb.dkeyJhbWe got to it in the end :p Thank you for the quick response :D Now I can continue11:42:33
10 Aug 2024
@matthewcroughan:defenestrate.itmatthewcroughan @ 39c3 (DECT 94667 or 97340 or 67192)Disko can't make something with an arbitrary sector start or gpt table length can it?21:48:22
@matthewcroughan:defenestrate.itmatthewcroughan @ 39c3 (DECT 94667 or 97340 or 67192)Is it possible with the gpt type to dd a nix store path to a partition?22:06:21
@matthewcroughan:defenestrate.itmatthewcroughan @ 39c3 (DECT 94667 or 97340 or 67192)I guess that'd be done in the postCreate hook, but it's quite an unsafe thing to do22:13:05
@matthewcroughan:defenestrate.itmatthewcroughan @ 39c3 (DECT 94667 or 97340 or 67192)not clear how to access the disko vars or what ones to access to get the absolute path to the partition in question, by nix evaluation22:13:25
11 Aug 2024
@matthewcroughan:defenestrate.itmatthewcroughan @ 39c3 (DECT 94667 or 97340 or 67192)Here's what I'm talking about, and the best I could come up with14:23:32
@matthewcroughan:defenestrate.itmatthewcroughan @ 39c3 (DECT 94667 or 97340 or 67192)
    devices = {
      disk = {
        disk1 = rec {
          type = "disk";
          device = "/dev/disk/by-id/usb-Generic-_SD_MMC_20120501030900000-0:0";
          postCreateHook = ''
            lsblk
            cat ${uboot}/bl2.bin > /dev/disk/by-partlabel/disk-disk1-bl2
            cat ${uboot}/fip.bin > /dev/disk/by-partlabel/disk-disk1-fip
            sgdisk -A 1:set:2 ${device}
          '';
          content = {
            type = "gpt";
            partitions = {
              bl2 = {
                start = "34";
                end = "8191";
                priority = 1;
                type = "8300";
              };
              fip = {
                start = "8192";
                end = "12287";
                priority = 2;
                type = "8300";
              };

14:23:35
@matthewcroughan:defenestrate.itmatthewcroughan @ 39c3 (DECT 94667 or 97340 or 67192) *
...
    disko.devices = {
      disk = {
        disk1 = rec {
          type = "disk";
          device = "/dev/disk/by-id/usb-Generic-_SD_MMC_20120501030900000-0:0";
          postCreateHook = ''
            lsblk
            cat ${uboot}/bl2.bin > /dev/disk/by-partlabel/disk-disk1-bl2
            cat ${uboot}/fip.bin > /dev/disk/by-partlabel/disk-disk1-fip
            sgdisk -A 1:set:2 ${device}
          '';
          content = {
            type = "gpt";
            partitions = {
              bl2 = {
                start = "34";
                end = "8191";
                priority = 1;
                type = "8300";
              };
              fip = {
                start = "8192";
                end = "12287";
                priority = 2;
                type = "8300";
              };
...
14:23:44
@matthewcroughan:defenestrate.itmatthewcroughan @ 39c3 (DECT 94667 or 97340 or 67192) notice how I've just guessed the by-partlabel paths and it's not happening by nix evaluation, and how I've had to use a recursive set to get the device path 14:24:24
@matthewcroughan:defenestrate.itmatthewcroughan @ 39c3 (DECT 94667 or 97340 or 67192)This also won't work in the image builder, it will only work for running the real disko script due to the dependency on the device path which will differ in the VM 14:24:49
@matthewcroughan:defenestrate.itmatthewcroughan @ 39c3 (DECT 94667 or 97340 or 67192)Another issue with using disko for embedded is that the label name is derived from the attributes16:01:57
@matthewcroughan:defenestrate.itmatthewcroughan @ 39c3 (DECT 94667 or 97340 or 67192)
Device       Start      End  Sectors Type-UUID                            UUID                                 Name            Attrs
/dev/sda1     2048     8191     6144 0FC63DAF-8483-4772-8E79-3D69D8477DE4 1422349D-2826-4F14-B386-22BAA5192059 disk-disk1-bl2  
/dev/sda2     8192    12287     4096 0FC63DAF-8483-4772-8E79-3D69D8477DE4 1A62DEAA-68A3-4601-A69A-7ADFE4ECDED9 disk-disk1-fip  
/dev/sda3    12288  2109439  2097152 C12A7328-F81F-11D2-BA4B-00A0C93EC93B FAB4CFF0-8873-4B78-B61E-E6252BA5EEDD disk-disk1-boot 
/dev/sda4  2109440 62332927 60223488 0FC63DAF-8483-4772-8E79-3D69D8477DE4 5A0ACF68-C9C3-4822-A92D-99A02DCFA863 disk-disk1-root 

16:01:58
@matthewcroughan:defenestrate.itmatthewcroughan @ 39c3 (DECT 94667 or 97340 or 67192) the name is disk-disk1-fip and not fip, but the u-boot bl2 (second stage bootloader) specifically reads this label and matches a string 16:02:24

Show newer messages


Back to Room ListRoom Version: 10