Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage for configurations without disko #274

Open
kagehisa opened this issue Jan 17, 2024 · 2 comments
Open

Usage for configurations without disko #274

kagehisa opened this issue Jan 17, 2024 · 2 comments

Comments

@kagehisa
Copy link

I've recently started to use nisos-anywhere to deploy my configurations which also inkludes a disko definition on machines that have a relative simple disk layout.
Now I'm struggling to use my data server as well as my Raspberry Pi with nixos-anywhere. The reason for the data server is that disko does not support a multi device setup for Btrfs at the moment so I would need to replace the disko step with a custom script. Same goes for the Raspberry Pi, since I'm using the UEFI Firmware on it the disk is already partitioned and only need to be mounted.

Would it be possible to have a flag like --skip-disko that requires/takes a script as argument which creates, formats and mounts the partitions to match the configuration given to nixos-anywhere? Basically a manual format and mount in the form of a script.

I know the use case is a bit niche but it would be helpful especially for the part with non supported setups by disko.

@kagehisa
Copy link
Author

Just seeing this #69 , having a pre formated disk or a manual disk preparation via ssh would work with this. But having a disk configuration not supported by disko remains a problem.
I know that getting disko to work with this configuration would be the more desired solution, but it seems filesystems with multi device features (except zfs) remain a problem with disko.

@0x450x6c
Copy link

For multi device btrfs, I'm using following workaround:

{
  lib,
  config,
  ...
}: {
  disko.devices = {
    disk.disk1 = {
      device = "/dev/disk/by-id/wwn-0x6000c2918383f7f5f16aa1866993b5d4";
      type = "disk";
      content = {
        type = "gpt";
        partitions = {
          boot = {
            priority = 1;
            size = "1M";
            type = "EF02";
          };
          root = {
            priority = 2;
            size = "100%";
          };
        };
      };
    };
    disk.disk2 = {
      device = "/dev/disk/by-id/wwn-0x6000c29543bc91b1bd5167d630966d24";
      type = "disk";
      content = {
        type = "gpt";
        partitions = {
          boot = {
            priority = 1;
            size = "1M";
            type = "EF02";
          };
          esp = {
            priority = 2;
            name = "ESP";
            size = "512M";
            type = "EF00";
            content = {
              type = "filesystem";
              format = "vfat";
              mountpoint = "/boot";
            };
          };
          root = {
            priority = 3;
            size = "100%";
            content = {
              type = "btrfs";
              extraArgs = ["/dev/disk/by-partlabel/disk-disk1-root" "-f" "-m raid1" "-d raid0"];
              mountpoint = "/mnt/root";
              mountOptions = ["compress=zstd"];
              subvolumes = {
                "/rootfs" = {
                  mountpoint = "/";
                  mountOptions = ["compress=zstd"];
                };
                "/home" = {
                  mountpoint = "/home";
                  mountOptions = ["compress=zstd"];
                };
                "/nix" = {
                  mountpoint = "/nix";
                  mountOptions = ["compress=zstd" "noatime"];
                };
                "/swap" = {
                  mountpoint = "/.swapvol";
                  mountOptions = ["compress=no" "noatime" "nodatacow"];
                  swap = {
                    swapfile.size = "2G";
                  };
                };
              };
            };
          };
        };
      };
    };
  };
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants