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
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