!oNSIfazDqEcwhcOjSL:matrix.org

disko

365 Members
disko - declarative disk partitioning - https://github.com/nix-community/disko95 Servers

Load older messages


SenderMessageTime
27 Apr 2025
@realhotgirlshit:envs.net@realhotgirlshit:envs.net Copied from #Nix / NixOS :

I’m trying to set up LUKS–style Btrfs full disk encryption on my older BIOS desktop with a layout generated from disko. I try to install it, but I get an error that says installation of GRUB on /dev/sda failed: No such file or directory.

The command I used:
sudo nix --extra-experimental-features nix-command --extra-experimental-features flakes run 'github:nix-community/disko/latest#disko-install' -- --flake '/etc/nixos#koolthing' --disk main /dev/sda

The relevant NixOS configuration:

# Disable UEFI.
  boot.loader.systemd-boot.enable = false;

  # Use the GRUB 2 boot loader.
  boot.loader.grub.enable = true;
  boot.loader.grub.efiSupport = false;

  boot.loader.efi.canTouchEfiVariables = false;
  # boot.loader.grub.efiInstallAsRemovable = true;
  # boot.loader.efi.efiSysMountPoint = "/boot/efi";
  # Define on which hard drive you want to install Grub.
  boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only

The entire disko configuration in its flake:

{
  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
  inputs.disko.url = "github:nix-community/disko/latest";
  inputs.disko.inputs.nixpkgs.follows = "nixpkgs";

  outputs = {self, disko, nixpkgs }: {
    nixosConfigurations.koolthing = nixpkgs.legacyPackages.x86_64-linux.nixos [
      ./configuration.nix
      disko.nixosModules.disko
      {
        disko.devices = {
	  disk = {
          main = {
            type = "disk";
            device = "/dev/vdb";
            content = {
              type = "gpt";
              partitions = {
                # Legacy BIOS, MBR-style partition table.
                boot = {
                  size = "1M";
                  type = "EF02"; # Grub MBR.
                };

                # The LUKS-encrypted root.
                luks = {
                  size = "300G";
                  content = {
                    type = "luks";
                    name = "crypted";

                    # Set up with an interactive password and not a keyfile.
                    settings = {
                      allowDiscards = true;
                    };

                    # The Btrfs filesystem.
                    content = {
                      type = "btrfs";
                      extraArgs = ["-f"]; # Overwrite any existing file system.
                      subvolumes = {
                        "/root" = {
                          mountpoint = "/";
                          mountOptions = [
                            "compress=zstd"
                            "noatime"
                          ];
                        };

                        # The home subvolume.
                        "/home" = {
                          mountpoint = "/home";
                          mountOptions = [
                            "compress=zstd"
                            "noatime"
                          ];
                        };

                        # The nix subvolume.
                        "/nix" = {
                          mountpoint = "/nix";
                          mountOptions = [
                            "compress=zstd"
                            "noatime"
                          ];
                        };
                      };
                    };
                  };
                };
              };
            };
          };
	};
        };
      }
    ];
  };
}
08:29:02
@realhotgirlshit:envs.net@realhotgirlshit:envs.netI’m pretty sure /dev/sda was listed in lsblk hmm I can check a little later08:30:41
@vengmark2:matrix.orgl0b0 Which disk devices do you have? Usually they match /dev/sd* or /dev/nvme*. 08:31:19
@realhotgirlshit:envs.net@realhotgirlshit:envs.net I have a 465.8 GB SSD showing up as /dev/sda, and it has a BIOS partition /dev/sda1, and a root partition that doesn’t take up the whole drive, just 300 GB 08:55:18
@vengmark2:matrix.orgl0b0 You do have device = "/dev/vdb"; in your configuration though. Not sure how that interacts with the CLI. 08:56:50
@vengmark2:matrix.orgl0b0 Why do I have to specify--disk NAME PATH when those are already in the configuration? 08:57:49
@vengmark2:matrix.orgl0b0 * Why do I have to specify--disk NAME DEVICE when those are already in the configuration? 08:57:57
@vengmark2:matrix.orgl0b0 * Why do I have to specify --disk NAME DEVICE when those are already in the configuration? 08:58:03
@realhotgirlshit:envs.net@realhotgirlshit:envs.net Oh okay, I’ll take a look at that 08:58:56
@realhotgirlshit:envs.net@realhotgirlshit:envs.netAlright I fixed that in the disko configuration, but I’m still getting the error09:04:36
@realhotgirlshit:envs.net@realhotgirlshit:envs.netProbably a good start though09:04:41
@realhotgirlshit:envs.net@realhotgirlshit:envs.netI’ll see if I can mess with the GRUB configuration09:05:02
@realhotgirlshit:envs.net@realhotgirlshit:envs.net I doubt nodev will work 09:05:50
@realhotgirlshit:envs.net@realhotgirlshit:envs.netYeah, same thing09:07:55
@realhotgirlshit:envs.net@realhotgirlshit:envs.net Got it to go through!
boot.loader.grub.enableCryptodisk = true
09:15:19
@realhotgirlshit:envs.net@realhotgirlshit:envs.netNow I probably just have to load a kernel module09:18:23
@mkg20001:mkg20001.iomkg20001 joined the room.14:15:25
@musjj:matrix.orgmusjj joined the room.14:43:05
@musjj:matrix.orgmusjj

Does it make sense to add additional fileSystems attribute for drives I don't want disko to manage/format like:

disko.devices.disk.main = { ... };
fileSystems = { ... };

Will this work correctly?

14:44:29
@musjj:matrix.orgmusjjTo clarify the filesystems I want to add lives on a different block device from disko's main disk.14:53:15
@rob.sliwi:matrix.orgrobsliwiWhy even bother adding them to disko at all?14:56:36
@mkg20001:mkg20001.iomkg20001
  grub = {
     efiSupport = true;
     #efiInstallAsRemovable = true; # in case canTouchEfiVariables doesn't work for your system
     device = "nodev";
  };

from here: https://nixos.wiki/wiki/Bootloader

14:58:39
@mkg20001:mkg20001.iomkg20001you need boot.loader.grub.device = "nodev"; when you have uefi+grub14:58:55
@musjj:matrix.orgmusjj I'm not adding them to disko, but directly to NixOS's fileSystems option 15:02:36
@musjj:matrix.orgmusjjLike, I have two devices, one for my OS and the other is just for my old data storage. I want disko to format and manage only the OS device and let NixOS normally mount the data storage device.15:04:10
@parismagpie:matrix.orgparismagpieHi ! So i'm trying to use disko to generate both a vm image and a raw image. It works, but the thing is I want to put secrets on some ext4 partition mounted over /etc/secrets. For the raw image, no problem.16:19:51
@parismagpie:matrix.orgparismagpieFor the VM image, I use virtualisation.vmVariantWithDisko.sharedDirectories to avoid putting secrets into the nix store (it works nicely with a classical vm)16:20:29
@parismagpie:matrix.orgparismagpie

But with disko, i'm getting some error :

       error: The option `virtualisation.vmVariantWithDisko.virtualisation.fileSystems."/etc/secrets".fsType' has conflicting definition values:
       - In `/nix/store/hzaj4d6ari2wq2cbg1j60n9zw42gnshy-source/nixos/modules/virtualisation/qemu-vm.nix': "9p"
       - In `/nix/store/7wf9q0mb1i43x9dr1qlyfaraq15n6sii-source/lib/interactive-vm.nix': "ext4"
       Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.

I believe this is because the disko vm image actually respects my partitions formats, but that's a bit of a problem for my specific usecase. I can remove the /etc/secrets partition definition in disko, and it works, but do I have any other option ?

16:21:57
@tcurdt:matrix.orgtcurdt

I am a little lost trying to get disko working in this setup https://github.com/tcurdt/nixos-hetzner/blob/main/install-nixos.sh

error: attribute 'createScript' missing

       at /nix/store/5dgq6q4jilxz6aipvhr24jsbzhvgy4zx-disko/share/disko/cli.nix:65:7:

           64|     else if (lib.traceValSeq hasDiskoModuleFlake) then
           65|       (builtins.getFlake flake).nixosConfigurations.${flakeAttr}.config.system.build.${diskoAttr}
             |       ^
           66|     else
17:52:49
@tcurdt:matrix.orgtcurdtThat's when I use v1.9.0 ... latest gives a different error17:53:12

Show newer messages


Back to Room ListRoom Version: 10