!oNSIfazDqEcwhcOjSL:matrix.org

disko

361 Members
disko - declarative disk partitioning - https://github.com/nix-community/disko92 Servers

Load older messages


SenderMessageTime
29 Jul 2024
@quentinmit:matrix.orgquentin

I'm trying to set up a ZFS root with disko. Without mountpoint set on the pool, the pool ends up mounted by disko at /mnt/zpool. So I set rootFsOptions.mountpoint = "/" which made the installer environment happy, but now the stage1 is failing with

mounting zpool on /...
stage 2 init script (/mnt-root//nix/store/...) not found
02:00:13
@quentinmit:matrix.orgquentin I'm guessing that means that the pool was supposed to mount at /mnt-root instead of /? How should I set the mountpoint options in disko to achieve that? 02:00:41
31 Jul 2024
@bashfulrobot.:matrix.orgbashfulrobotQq. Do I have to add disko to my config? Or can I just write a nix file and run against it? Then run nix-install and leverage what it created?03:10:59
@matthewcroughan:defenestrate.itmatthewcroughan
In reply to @bashfulrobot.:matrix.org
Qq. Do I have to add disko to my config? Or can I just write a nix file and run against it? Then run nix-install and leverage what it created?
You can do either, but it's much nicer if it's in your config, since then you'll get things mounted automatically based on your disko config
03:24:08
@bashfulrobot.:matrix.orgbashfulrobot
In reply to @matthewcroughan:defenestrate.it
You can do either, but it's much nicer if it's in your config, since then you'll get things mounted automatically based on your disko config
Ahhhhh. Ok. I didn’t realize that the config still “did stuff” post creation of the file system, etc.
08:01:36
@bashfulrobot.:matrix.orgbashfulrobotSo I guess the process would be to write it into my config, use nix run on my disko file, install , rebuild with my config files which include the same disko file. August the direct!10:22:39
2 Aug 2024
@nevrv:matrix.orgnrv There's currently no option to run commands after all mounts after creation is there? (I need to set owners & modes & acls) 11:56:52
@nevrv:matrix.orgnrv Or maybe i can hack something like take all the mountpoints sort them and then take last and condition the postMountHook on it (which is annoying) 12:00:26
@nevrv:matrix.orgnrv * Or maybe i can hack something like take all the mountpoints sort them and then take last and condition the postMountHook on it (which is annoying and i'm not sure will work) 12:02:11
@nevrv:matrix.orgnrv To clarify. I think that postMountHook runs after every mount. That is correct right? 12:09:46
@lassulus:lassul.uslassulusonly the initial mount done by the disko cli or nixos-anywhere, the mount in the installer12:40:47
@nevrv:matrix.orgnrvi mean every mount that is done by disko installer12:50:49
@nevrv:matrix.orgnrvthat is runs after / is mounted, after /home is mounted, and after whatever is mounted else12:51:34
@nevrv:matrix.orgnrvat least that's what it seemed to me12:51:56
@nevrv:matrix.orgnrv * that it runs after / is mounted, after /home is mounted, and after whatever is mounted else12:52:12
@nevrv:matrix.orgnrv * that it runs after / is mounted, after /home is mounted, and after whatever else is mounted 12:52:32
@nevrv:matrix.orgnrv * at least that's what it seemed to me, that instead of a single run after all mounts is done maybe i messed up something12:53:19
@nevrv:matrix.orgnrv * at least that's what it seemed to me, that instead of a single run after all mounts is done it runs after each mount maybe i messed up something12:56:09
@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

Show newer messages


Back to Room ListRoom Version: 10