From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id eFa8OIZh2mWLZQAAqHPOHw:P1 (envelope-from ) for ; Sat, 24 Feb 2024 22:37:11 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id eFa8OIZh2mWLZQAAqHPOHw (envelope-from ) for ; Sat, 24 Feb 2024 22:37:11 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=abesis.fr header.s=mail header.b=+b1vWohb; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1708810630; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=kjoQmxx0plkStnjkTDgZuQHIUl8t7jjBmQEnPMdOVaE=; b=n0/0xjsW5BIcKim3eNO0lmbb5s81SzsuFcS27rSl6NQDTvBNairrB5TvtmOQ5xnPQd2rTO MgtnQXUxwtAttE4FBmKjesUVKUdyCj7CST3UMk8QSfbYPvZjrMPBKj21o4pN2J20tO9zNM L3DQX7RWMBrlBOO9MhPg9C6OitIi55sgDWblhjpUDdgeFWOoejt3Levrt9L2XAN7HXKC2F biIdC0N6ryAMQ46235xR4j37PPbv9WX7ETVDduxpCWefSHySQhm/ix/fBUivKUOwP4CnS/ E2j+cb4SEfMA25Q07d3COJlKkosFEmZJWLGhNj8WhWzspMXMvrox1yOYghzIlw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=abesis.fr header.s=mail header.b=+b1vWohb; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1708810630; a=rsa-sha256; cv=none; b=JlVvEiO8rem5lgTCTbfSYRM2G3+6sFTd7rNhow9PhxITqzaQJeuBW+Gno3pshTFboNWSoO SDDhEoyv8rX14ZEqfwOTNG32tJgylcmVW+PNL9CrldQdZDq1yrTtfJwQqYQbGVq0qyn/3n XhU8FDg7UhXgi9IGQhmBJdd3Z5P6WDnRGPpxAHwoqOIW2IfLB/6YzczROvdTg7MdPYJ6wY hk/NsyEwBlp3XpSqQtcVZc4cx2v7pUknwE5yhpM13kNy5C7JJ5k+d1IQ1Ye1fFSDqCPM3n Q34h12qseTgfJa9C6hcvh395e1Mvj40Uir8TTVDervx/99XG+VvifuoivxDkeQ== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C518220327 for ; Sat, 24 Feb 2024 22:37:10 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdyw2-0006Az-5F; Sat, 24 Feb 2024 15:47:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdoJT-0007AZ-FW for guix-devel@gnu.org; Sat, 24 Feb 2024 04:27:19 -0500 Received: from kordia.abesis.fr ([37.187.96.121]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdoJR-0003Oy-D0 for guix-devel@gnu.org; Sat, 24 Feb 2024 04:27:19 -0500 From: Antoine Eiche DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=abesis.fr; s=mail; t=1708766830; bh=kjoQmxx0plkStnjkTDgZuQHIUl8t7jjBmQEnPMdOVaE=; h=From:To:Subject:Date; b=+b1vWohb86SpnHZ4dF9kgtFA0sQsRRf8Kv2/VIisjTLykaKRY+P04thGdZYyKvSvn vZ3xD346nq2Pt0cdQkFgrrPMd03lvdDiJWxOm/cmhLtm03PyQoYf0JUE0wHlX0L0tL ljXExSy5dN9y0b4Q32YSvKo0SZzDPOcep4Or62zg= To: guix-devel@gnu.org Subject: Building container images with nix2container Date: Sat, 24 Feb 2024 10:27:05 +0100 Message-ID: <8734tijjpy.fsf@tilia> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=37.187.96.121; envelope-from=lewo@abesis.fr; helo=kordia.abesis.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 24 Feb 2024 15:47:48 -0500 X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -2.12 X-Spam-Score: -2.12 X-Migadu-Queue-Id: C518220327 X-TUID: mZiDf01BWRn/ Hello Guix, Two years ago, i released nix2container [1], a Go library and binary to build container images from Nix expressions. However, this Go code is not tightly coupled with Nix and has been designed to potentially work with Guix [2]! nix2container offers the following main features: - It uses a layering algorithm to group storepaths into layers [3] - It avoids writing an image tarball in your Guix store (reduce IOs and storage) Basically, to build a container image, nix2container relies on two steps: 1. The nix2container Go binary takes the reference graph [4] of the container image closure to generates a JSON file describing the image configuration and the layers. 2. This JSON file can then be consumed by a patched Skopeo version[5] to build or push an image [8]. In case you would like to try nix2container with Guix, in theory, you would need to add the support of another input reference graph format [6] and a write simple Guix derivations [7] calling the nix2container binary. Hoping it could be useful, lewo. [1] https://github.com/nlewo/nix2container [2] https://github.com/nlewo/containers-image-nix/blob/e342762cf7274dd7449343f3488723898da63f00/nix/utils.go#L55 [3] https://grahamc.com/blog/nix-and-layered-docker-images/ [4] https://nixos.org/manual/nix/stable/language/advanced-attributes.html?highlight=exportReferencesGraph#adv-attr-exportReferencesGraph [5] https://github.com/nlewo/containers-image-nix/blob/9d7f33ef0058f4df4c0912025f43c758a3289d76/default.nix#L31 [6] https://github.com/nlewo/containers-image-nix/blob/9d7f33ef0058f4df4c0912025f43c758a3289d76/data/closure-graph.json#L1 [7] https://github.com/nlewo/containers-image-nix/blob/9d7f33ef0058f4df4c0912025f43c758a3289d76/default.nix#L305 [8] https://github.com/nlewo/containers-image-nix/blob/9d7f33ef0058f4df4c0912025f43c758a3289d76/default.nix#L47