patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <alyssa.ross@unikie.com>
To: Ivan Nikolaenko <ivan.nikolaenko@unikie.com>
Cc: devel@spectrum-os.org
Subject: Re: [PATCH] EFI Loader: use correct arch suffix
Date: Tue, 27 Sep 2022 11:17:58 +0000	[thread overview]
Message-ID: <87h70t83rt.fsf@alyssa.is> (raw)
In-Reply-To: <20220927105649.2265480-1-ivan.nikolaenko@unikie.com>

[-- Attachment #1: Type: text/plain, Size: 2025 bytes --]

Ivan Nikolaenko <ivan.nikolaenko@unikie.com> writes:

> Previously there were hardcoded "x64" in EFI loaders' filenames.
>
> Signed-off-by: Ivan Nikolaenko <ivan.nikolaenko@unikie.com>
> ---
>  img/combined/default.nix |  5 +++--
>  img/live/Makefile        |  2 +-
>  img/live/default.nix     |  5 +++--
>  nix/eval-config.nix      | 11 ++++++++++-
>  4 files changed, 17 insertions(+), 6 deletions(-)

Thanks for looking at this.  I knew this would come up at some point!

Your patch looks good, except:

> diff --git a/nix/eval-config.nix b/nix/eval-config.nix
> index 467f877..4234321 100644
> --- a/nix/eval-config.nix
> +++ b/nix/eval-config.nix
> @@ -8,6 +8,15 @@
>    else {}
>  }:
>  
> -({ pkgs ? import <nixpkgs> {} }: {
> +({ pkgs ? import <nixpkgs> {} }: with pkgs; {
>    inherit pkgs;
> +
> +  archSuffix =
> +    if pkgs.stdenv.isx86_64 then
> +      "x64"
> +    else if pkgs.stdenv.isAarch64 then
> +      "aa64"
> +    else
> +      throw "Unsupported architecture";
> +
>  }) config
> -- 
> 2.25.1

I don't really want this file to turn into an unstructured list of
global constants, but I think there might be a better way:

Nixpkgs already has an unexposed mapping of Nixpkgs platforms to EFI
architecture names[1], so it would be a shame to have to duplicate it
ourselves.  What if instead, we moved that list somewhere accessible in
Nixpkgs, like how Nixpkgs already exposes the Linux and QEMU names for
architectures[2]?  Then we could just access stdenv.hostPlatform.efiArch
or whatever in our Nix expressions, and so could Nixpkgs.

I imagine that'd be a welcome (and small) Nixpkgs refactoring, and I'd
gladly backport it to Spectrum's Nixpkgs immediately after it was
accepted upstream.

[1]: https://github.com/NixOS/nixpkgs/blob/68770d269df8d7d8c7deba87156f66b0f997c071/nixos/modules/installer/cd-dvd/iso-image.nix#L434-L445
[2]: https://github.com/NixOS/nixpkgs/blob/68770d269df8d7d8c7deba87156f66b0f997c071/lib/systems/default.nix#L118

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2022-09-27 11:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27 10:56 Ivan Nikolaenko
2022-09-27 11:17 ` Alyssa Ross [this message]
2022-09-29  8:44   ` Alyssa Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h70t83rt.fsf@alyssa.is \
    --to=alyssa.ross@unikie.com \
    --cc=devel@spectrum-os.org \
    --cc=ivan.nikolaenko@unikie.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).