~sircmpwn/sr.ht-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH builds.sr.ht] images/nixos: pass optional system attribute to evalConfig

nessdoor <tlopez@keio.jp>
Details
Message ID
<20230818124807.852337-1-tlopez@keio.jp>
DKIM signature
missing
Download raw message
Patch: +4 -1
This allows for image.nix to be used inside hermetic builds where
builtins.currentSystem is not available as an attribute.
---
During an ongoing effort to update the NixOS module for Sourcehut, we
noticed that this minor change allows us to make direct use of your
image.nix even when building system configurations inside flakes.

 images/nixos/image.nix | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/images/nixos/image.nix b/images/nixos/image.nix
index 227039b..7e53e78 100644
--- a/images/nixos/image.nix
+++ b/images/nixos/image.nix
@@ -1,9 +1,12 @@
{ pkgs ? import <nixpkgs> {} }:
{ pkgs ? import <nixpkgs> {}
, system ? builtins.currentSystem
}:

let
  makeDiskImage = import "${pkgs.path}/nixos/lib/make-disk-image.nix";
  evalConfig = import "${pkgs.path}/nixos/lib/eval-config.nix";
  config = (evalConfig {
    inherit system;
    modules = [ (import ./qemu-system-configuration.nix) ];
  }).config;
in
-- 
2.40.1

[builds.sr.ht/patches] build failed

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CUVOPO7QY94S.2WPEUUASHQJPQ@cirno2>
In-Reply-To
<20230818124807.852337-1-tlopez@keio.jp> (view parent)
DKIM signature
missing
Download raw message
builds.sr.ht/patches: FAILED in 4m42s

[images/nixos: pass optional system attribute to evalConfig][0] from [nessdoor][1]

[0]: https://lists.sr.ht/~sircmpwn/sr.ht-dev/patches/43741
[1]: tlopez@keio.jp

✗ #1043270 FAILED  builds.sr.ht/patches/archlinux.yml https://builds.sr.ht/~sircmpwn/job/1043270
✓ #1043271 SUCCESS builds.sr.ht/patches/debian.yml    https://builds.sr.ht/~sircmpwn/job/1043271
✓ #1043269 SUCCESS builds.sr.ht/patches/alpine.yml    https://builds.sr.ht/~sircmpwn/job/1043269
Details
Message ID
<20230822163416.49cee032@lambda>
In-Reply-To
<20230818124807.852337-1-tlopez@keio.jp> (view parent)
DKIM signature
missing
Download raw message
On Fri, 18 Aug 2023 14:48:08 +0200
nessdoor <tlopez@keio.jp> wrote:

> This allows for image.nix to be used inside hermetic builds where
> builtins.currentSystem is not available as an attribute.
> ---
> During an ongoing effort to update the NixOS module for Sourcehut, we
> noticed that this minor change allows us to make direct use of your
> image.nix even when building system configurations inside flakes.
> 
>  images/nixos/image.nix | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/images/nixos/image.nix b/images/nixos/image.nix
> index 227039b..7e53e78 100644
> --- a/images/nixos/image.nix
> +++ b/images/nixos/image.nix
> @@ -1,9 +1,12 @@
> -{ pkgs ? import <nixpkgs> {} }:
> +{ pkgs ? import <nixpkgs> {}
> +, system ? builtins.currentSystem
> +}:
>  
>  let
>    makeDiskImage = import
> "${pkgs.path}/nixos/lib/make-disk-image.nix"; evalConfig = import
> "${pkgs.path}/nixos/lib/eval-config.nix"; config = (evalConfig {
> +    inherit system;

Looking at eval-config.nix and nixpkgs.system, this appears to be a
legacy option, superseded by the modular `nixpkgs.hostPlatform`. Maybe
setting it to null and having a `hostPlatform` parameter would be more
future-proof.

>      modules = [ (import ./qemu-system-configuration.nix) ];
>    }).config;
>  in
Reply to thread Export thread (mbox)