Subject: [bug#74564] [PATCH] gnu: Add podman-docker.

From: Arjan Adriaanse <[email-masked]>
Date: Thu, 28 Nov 2024 00:52:14 +0100

* gnu/packages/containers.scm (podman-docker): New variable.

Change-Id: Ib6a3e0423d8257ce13e72ac12a908da42015cf8d
---
 gnu/packages/containers.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/containers.scm b/gnu/packages/containers.scm
index c638736cda..b606215842 100644
--- a/gnu/packages/containers.scm
+++ b/gnu/packages/containers.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2024 Tomas Volf <[email-masked]>
 ;;; Copyright © 2024 Foundation Devices, Inc. <[email-masked]>
 ;;; Copyright © 2024 Jean-Pierre De Jesus DIAZ <[email-masked]>
+;;; Copyright © 2024 Arjan Adriaanse <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -44,6 +45,7 @@ (define-module (gnu packages containers)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gnupg)
@@ -576,6 +578,33 @@ (define-public podman
 @code{openssh} packages.")
     (license license:asl2.0)))
 
+(define-public podman-docker
+  (package/inherit podman
+    (name "podman-docker")
+    (native-inputs `(,@(package-native-inputs podman)
+                     ("gettext" ,gettext-minimal))) ; for envsubst
+    (propagated-inputs (list podman))
+    (build-system copy-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'set-env
+            (lambda _
+              ;; When running go, things fail because HOME=/homeless-shelter.
+              (setenv "HOME" "/tmp")
+              (setenv "PREFIX" #$output)
+              (setenv "ETCDIR" (string-append #$output "/etc"))))
+          (replace 'install
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "Makefile"
+                (("BINDIR=\\$\\{BINDIR\\}") ; directory of podman command
+                 (string-append "BINDIR=" (assoc-ref inputs "podman") "/bin"))
+                (("ETCDIR=\\$\\{ETCDIR\\}") ; configuration directory
+                 "ETCDIR='$${XDG_CONFIG_HOME}'"))
+              (invoke "make" "docker-docs" "install.docker-full"))))))
+    (synopsis "Emulate Docker CLI using Podman")))
+
 (define-public podman-compose
   (package
     (name "podman-compose")

base-commit: c6d15cf27a137051ccd8f301330a70dd0eecc3d4
-- 
2.46.0