nixos-generators icon indicating copy to clipboard operation
nixos-generators copied to clipboard

raw-efi format seems to be broken

Open mikroskeem opened this issue 3 years ago • 3 comments

Using flake & numtide/flake-utils:

(system: let
  pkgs = nixpkgs.legacyPackages.${system};
in {
  packages.rawBootstrap =
    inputs.nixos-generators.nixosGenerate {
      inherit pkgs;
      format = "raw-efi";
      modules = [
        ./systems/_common/nix.nix
      ];
    };
})

nix flake show will error with error: expected a derivation.

Upon further digging, it appears that packages.x86_64-linux.rawBootstrap is something in the lines of { _type = "override"; content = «derivation /nix/.../.drv»; priority = 999; }

Temporary fix to that is wrapping nixosGenerate function call into (...).content.

Same problem appears without flake-utils, as expected.

nixos-generators commit: 05a3eb158a9c7746a5d463726d7f7cccf07500e4 numtide/flake-utils commit: 74f7e4319258e287b0f9cb95426c9853b282730b

mikroskeem avatar Dec 22 '21 11:12 mikroskeem

I wrote that function, but never tried that format - sorry it didn't work for you! It seems like there are at least two possible ways of fixing this: do we think this should be fixed with a special case in nixos-generate or is it possible to fix upstream so that efi is consistent with the other formats?

mayl avatar Dec 22 '21 14:12 mayl

If issue's root is in upstream, then we shall try fixing upstream.

mikroskeem avatar Dec 22 '21 14:12 mikroskeem

Hello

I can confirm it doesnt work with flakes (i did not try something else)

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    nixos-generators = {
      url = "github:nix-community/nixos-generators";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, nixos-generators, ... }: {
    packages.x86_64-linux = {
      ## to build just do nix build .#rawefi
      rawefi = nixos-generators.nixosGenerate {
        pkgs = nixpkgs.legacyPackages.x86_64-linux;
        format = "raw-efi";
      };
    };
  };
}

when i nix build i get the following errors

17:56 $ nix build .#rawefi
error: flake output attribute 'packages.x86_64-linux.rawefi' is not a derivation

putchar avatar Jan 08 '22 17:01 putchar