astro / nix-openwrt-imagebuilder

Build OpenWRT images in Nix derivations
MIT License
129 stars 16 forks source link

How to build the generic images? #40

Closed p4p4j0hn closed 4 months ago

p4p4j0hn commented 4 months ago

I am unsure how to proceed with building the generic x86_64 target or any other generic target. There is no target profile, only the generic variant for the architecture. Is this a supported use case?

I tried using this flake.nix and other variations of the profile like x86/64, openwrt-x86-64-generic, generic, and x86-64-generic. I also tried indicating the release, target, variant, and profile directly.

{
  inputs = {
    openwrt-imagebuilder.url = "github:astro/nix-openwrt-imagebuilder";
  };
  outputs = { self, nixpkgs, openwrt-imagebuilder }: {
    packages.x86_64-linux.router =
      let
        pkgs = nixpkgs.legacyPackages.x86_64-linux;
        profiles = openwrt-imagebuilder.lib.profiles { inherit pkgs; };
        config = profiles.identifyProfile "x86-64" // {
          #release = "23.05.03";
          #target = "x86";
          #variant = "64";
          #profile = "generic";
          packages = [
            ...
          ];
        };
      in
        openwrt-imagebuilder.lib.build config;
  };
}
astro commented 4 months ago

In my opinion, "generic" is too ambiguous to fix this in code.

Your commented out approach of specifying the profile manually was on the right track. You just need to drop the identifyProfile. I've added an example.