From 8e9c7e7c00602cdd5338af838f7710f030ae424f Mon Sep 17 00:00:00 2001 From: Paul Haerle Date: Mon, 5 Aug 2024 08:46:14 +0200 Subject: [PATCH] build linux images on darwin (#83) The assert in pkgs.nix currently just throws if you try to build on darwin. As there's no such thing as darwin in a container, I believe it should be safe to assume that people want to build linux containers. This defaults to the current platform, but still lets users specify system to i.e. build x86_64-linux containers from an aarch64-darwin host. --- default.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 55ea7b5..2df82e8 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,14 @@ { system ? builtins.currentSystem }: let - pkgs = import ./pkgs.nix system; + _parts = builtins.split "-" system; + arch = builtins.elemAt _parts 0; + os = builtins.elemAt _parts 2; + system' = + if os == "darwin" + then "${arch}-linux" + else system; + pkgs = + import ./pkgs.nix system'; in pkgs.docker-nixpkgs