summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Hensing <roberth@users.noreply.github.com>2022-10-27 17:52:45 +0200
committerGitHub <noreply@github.com>2022-10-27 17:52:45 +0200
commit8837a5d68efc8dedfb7f7e0a636ea6f81ae06c71 (patch)
tree2d81e21921b049cf9309300c86b2caea9f812cc3
parentd7dae316b4a191f9434452fd010025fe0bfb26e2 (diff)
parentf4ccaa51e00d1fa9dde060a90e4b721ddbe5024a (diff)
downloadnixpkgs-8837a5d68efc8dedfb7f7e0a636ea6f81ae06c71.tar
nixpkgs-8837a5d68efc8dedfb7f7e0a636ea6f81ae06c71.tar.gz
nixpkgs-8837a5d68efc8dedfb7f7e0a636ea6f81ae06c71.tar.bz2
nixpkgs-8837a5d68efc8dedfb7f7e0a636ea6f81ae06c71.tar.lz
nixpkgs-8837a5d68efc8dedfb7f7e0a636ea6f81ae06c71.tar.xz
nixpkgs-8837a5d68efc8dedfb7f7e0a636ea6f81ae06c71.tar.zst
nixpkgs-8837a5d68efc8dedfb7f7e0a636ea6f81ae06c71.zip
Merge pull request #195681 from maifel-maifel/mr-containers-hostPlatform
nixos/containers: now uses nixpkgs.hostPlatform
-rw-r--r--nixos/modules/virtualisation/nixos-containers.nix10
1 files changed, 6 insertions, 4 deletions
diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix
index 6cb21913b21..fae7c576805 100644
--- a/nixos/modules/virtualisation/nixos-containers.nix
+++ b/nixos/modules/virtualisation/nixos-containers.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, pkgs, ... }@host:
 
 with lib;
 
@@ -284,7 +284,6 @@ let
     DeviceAllow = map (d: "${d.node} ${d.modifier}") cfg.allowedDevices;
   };
 
-  inherit (config.nixpkgs) localSystem;
   kernelVersion = config.boot.kernelPackages.kernel.version;
 
   bindMountOpts = { name, ... }: {
@@ -480,10 +479,13 @@ in
                 merge = loc: defs: (import "${toString config.nixpkgs}/nixos/lib/eval-config.nix" {
                   modules =
                     let
-                      extraConfig = {
+                      extraConfig = { options, ... }: {
                         _file = "module at ${__curPos.file}:${toString __curPos.line}";
                         config = {
-                          nixpkgs = { inherit localSystem; };
+                          nixpkgs = if options.nixpkgs?hostPlatform && host.options.nixpkgs.hostPlatform.isDefined
+                                    then { inherit (host.config.nixpkgs) hostPlatform; }
+                                    else { inherit (host.config.nixpkgs) localSystem; }
+                          ;
                           boot.isContainer = true;
                           networking.hostName = mkDefault name;
                           networking.useDHCP = false;