Skip to content

Disko-install fails without any verbose message #1179

@deep4lpha

Description

@deep4lpha

Hi,

I'm struggling to get disko-install to work.

  1. I boot a qemu vm with minimal install
  2. I remount /nix to have more space mount -o remount,size=10G,noatime /nix/.rw-store
  3. I copy over my flake (shown below)
  4. I generate hardware-config for my flake with nixos-generate-config --no-filesystems --root /tmp/cfg and copy it to my flake
  5. I run sudo nix --extra-experimental-features 'flakes nix-command' run github:nix-community/disko#disko-install -- --flake '.#nix-playground' --disk main /dev/sda --show-trace
  6. After download and "these 173 derivations will be built" I get Failed to build NixOS configuration.

When I use sudo nix --extra-experimental-features 'flakes nix-command' run github:nix-community/disko -- --mode disko <path/to/disk-config.nix> and then do the regular flake nixos install all works fine.

Below is my flake.nix (I stripped out anything just to leave basic host config and this below still fails to install):

{
  description = "disko test";

  inputs = {
    # Specify the source of Home Manager and Nixpkgs.
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

    disko.url = "github:nix-community/disko";
    disko.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs =
    {
      nixpkgs,
      disko,
      ...
    }@inputs:
    let
      system = "x86_64-linux";
      my_overlays = import ./overlays (inputs // { inherit system; });

     pkgs = import nixpkgs {
	inherit system;
     };
      hosts = {
        nix-playground = {
          username = "myuser";
        };
        server = {
          username = "root";
        };
      };

      mkSystem =
        hostName: opts:
        nixpkgs.lib.nixosSystem {
          inherit system;
          modules = [
           #{ nixpkgs.overlays = nix_overlays; }
            ./nixos/${hostName}/disk-config.nix
            disko.nixosModules.disko
            ./nixos/${hostName}/configuration.nix

          ];
        };
    in
    {
      nixosConfigurations = builtins.mapAttrs mkSystem hosts;
    };
}

The nixos/nix-playground/configuration.nix:

{ config, pkgs, ... }:

{
  imports = [
    ./hardware-configuration.nix # generate with nixos-generate-config
  ];

  boot.loader.systemd-boot.enable = true;
  networking.hostName = "nix-playground";
  services.openssh.enable = true;

  environment.systemPackages = with pkgs; [
    zsh
    git
    neovim
  ];
  users.users.myuser = {
    isNormalUser = true;
    extraGroups = [ "wheel" ];
    openssh.authorizedKeys.keys = [
      "key here"
    ];
  };

  system.stateVersion = "25.11";
}

And finally the nixos/nix-playground/disk-config.nix:

{
  disko.devices = {
    disk = {
      main = {
        type = "disk";
        device = "/dev/disk/by-diskseq/1";
        content = {
          type = "gpt";
          partitions = {
            ESP = {
              priority = 1;
              name = "ESP";
              start = "1M";
              end = "128M";
              type = "EF00";
              content = {
                type = "filesystem";
                format = "vfat";
                mountpoint = "/boot";
                mountOptions = [ "umask=0077" ];
              };
            };
            root = {
              size = "100%";
              content = {
                type = "btrfs";
                extraArgs = [ "-f" ]; # Override existing partition
                # Subvolumes must set a mountpoint in order to be mounted,
                # unless their parent is mounted
                subvolumes = {
                  # Subvolume name is different from mountpoint
                  "/rootfs" = {
                    mountpoint = "/";
                  };
                  # Subvolume name is the same as the mountpoint
                  "/home" = {
                    mountOptions = [ "compress=zstd" ];
                    mountpoint = "/home";
                  };
                  # Sub(sub)volume doesn't need a mountpoint as its parent is mounted
                  "/home/myuser" = { };
                  # Parent is not mounted so the mountpoint must be set
                  "/nix" = {
                    mountOptions = [
                      "compress=zstd"
                      "noatime"
                    ];
                    mountpoint = "/nix";
                  };
                };

              };
            };
          };
        };
      };
    };
  };
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions