Subject: [bug#68549] [PATCH] gnu: Add "go-github-com-coreos-go-systemd" sub-packages.

From: "Artyom V. Poptsov" <[email-masked]>
Date: Sun, 11 Feb 2024 23:19:04 +0300

Hello Maxim!

Thank you for the patch review!

Here's the fixed version of the patches.
From b580cf281893bca1cf42296430099668e12d3d5e Mon Sep 17 00:00:00 2001
Message-ID: <b580cf[email-masked]>
From: "Artyom V. Poptsov" <[email-masked]>
Date: Wed, 17 Jan 2024 22:25:00 +0300
Subject: [PATCH 1/7] gnu: Add go-github-com-coreos-go-systemd-daemon.

* gnu/packages/golang.scm (go-github-com-coreos-go-systemd-daemon): New
  variable.

Change-Id: If79215d0676b9bb8dfe6e12a144a9b156f43f9be
---
 gnu/packages/golang.scm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 163691a1e6..9d732b595d 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -8625,6 +8625,19 @@ (define-public go-github-com-coreos-go-systemd-activation
 using socket activation from Go.")
     (license license:asl2.0)))
 
+(define-public go-github-com-coreos-go-systemd-daemon
+  (package
+    (inherit go-github-com-coreos-go-systemd-activation)
+    (name "go-github-com-coreos-go-systemd-daemon")
+    (arguments
+     '(#:import-path "github.com/coreos/go-systemd/daemon"
+       #:unpack-path "github.com/coreos/go-systemd"))
+    (home-page "https://github.com/coreos/go-systemd")
+    (synopsis "Go bindings to systemd for notifications")
+    (description "Go bindings to systemd for notifying the daemon of service status
+changes")
+    (license license:asl2.0)))
+
 (define-public go-github-com-emirpasic-gods
   (package
     (name "go-github-com-emirpasic-gods")

base-commit: 9edbb2d7a40c9da7583a1046e39b87633459f656
-- 
2.41.0

From 2990002874fcec1feca941b5d1137fc73ef04138 Mon Sep 17 00:00:00 2001
Message-ID: <299000[email-masked]>
In-Reply-To: <b580cf[email-masked]>
References: <b580cf[email-masked]>
From: "Artyom V. Poptsov" <[email-masked]>
Date: Wed, 17 Jan 2024 22:34:12 +0300
Subject: [PATCH 2/7] gnu: Add go-github-com-coreos-go-systemd-dbus.

* gnu/packages/golang.scm (go-github-com-coreos-go-systemd-dbus): New
  variable.

Change-Id: Ib50ff86ec7c03fd8b5e732dc9b3ec5e4196d8d3b
---
 gnu/packages/golang.scm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 9d732b595d..ec5f4f1919 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -8638,6 +8638,22 @@ (define-public go-github-com-coreos-go-systemd-daemon
 changes")
     (license license:asl2.0)))
 
+(define-public go-github-com-coreos-go-systemd-dbus
+  (package
+    (inherit go-github-com-coreos-go-systemd-activation)
+    (name "go-github-com-coreos-go-systemd-dbus")
+    (arguments
+     '(#:tests? #f ;Tests require D-Bus daemon running.
+       #:import-path "github.com/coreos/go-systemd/dbus"
+       #:unpack-path "github.com/coreos/go-systemd"))
+    (native-inputs (list go-github-com-godbus-dbus))
+    (home-page "https://github.com/coreos/go-systemd")
+    (synopsis "Go bindings to systemd for managing services")
+    (description
+     "Go bindings to systemd for starting/stopping/inspecting running services and
+units.")
+    (license license:asl2.0)))
+
 (define-public go-github-com-emirpasic-gods
   (package
     (name "go-github-com-emirpasic-gods")
-- 
2.41.0

From 529d69e701b8bf8eb33d0bae832618ddbe0c8a1c Mon Sep 17 00:00:00 2001
Message-ID: <529d69[email-masked]>
In-Reply-To: <b580cf[email-masked]>
References: <b580cf[email-masked]>
From: "Artyom V. Poptsov" <[email-masked]>
Date: Wed, 17 Jan 2024 22:38:38 +0300
Subject: [PATCH 3/7] gnu: Add go-github-com-coreos-go-systemd-journal.

* gnu/packages/golang.scm (go-github-com-coreos-go-systemd-journal): New
  variable.

Change-Id: I6a8ae9d416ce7c4236ce0d8a8388da130964144c
---
 gnu/packages/golang.scm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index ec5f4f1919..4fae497d87 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -8654,6 +8654,21 @@ (define-public go-github-com-coreos-go-systemd-dbus
 units.")
     (license license:asl2.0)))
 
+(define-public go-github-com-coreos-go-systemd-journal
+  (package
+    (inherit go-github-com-coreos-go-systemd-activation)
+    (name "go-github-com-coreos-go-systemd-journal")
+    (arguments
+     '(#:tests? #f ;Tests require access to journald socket.
+       #:import-path "github.com/coreos/go-systemd/journal"
+       #:unpack-path "github.com/coreos/go-systemd"))
+    (home-page "https://github.com/coreos/go-systemd")
+    (synopsis "Go bindings to systemd for writing journald")
+    (description
+     "Go bindings to systemd for writing to systemd's logging service,
+journald.")
+    (license license:asl2.0)))
+
 (define-public go-github-com-emirpasic-gods
   (package
     (name "go-github-com-emirpasic-gods")
-- 
2.41.0

From b19724ad1418b870b1cc121960ac1b547feceb26 Mon Sep 17 00:00:00 2001
Message-ID: <b19724[email-masked]>
In-Reply-To: <b580cf[email-masked]>
References: <b580cf[email-masked]>
From: "Artyom V. Poptsov" <[email-masked]>
Date: Wed, 17 Jan 2024 22:43:37 +0300
Subject: [PATCH 4/7] gnu: Add go-github-com-coreos-go-systemd-login1.

* gnu/packages/golang.scm (go-github-com-coreos-go-systemd-login1): New
  variable.

Change-Id: I815e67c119b00232a620004f72e6b61d90d2c06a
---
 gnu/packages/golang.scm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 4fae497d87..2a36f6b299 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -8669,6 +8669,21 @@ (define-public go-github-com-coreos-go-systemd-journal
 journald.")
     (license license:asl2.0)))
 
+(define-public go-github-com-coreos-go-systemd-login1
+  (package
+    (inherit go-github-com-coreos-go-systemd-activation)
+    (name "go-github-com-coreos-go-systemd-login1")
+    (arguments
+     '(#:tests? #f ;Tests require D-Bus daemon running.
+       #:import-path "github.com/coreos/go-systemd/login1"
+       #:unpack-path "github.com/coreos/go-systemd"))
+    (native-inputs (list go-github-com-godbus-dbus))
+    (home-page "https://github.com/coreos/go-systemd")
+    (synopsis "Go bindings to systemd for integration with logind API")
+    (description
+     "Go bindings to systemd for integration with the systemd logind API.")
+    (license license:asl2.0)))
+
 (define-public go-github-com-emirpasic-gods
   (package
     (name "go-github-com-emirpasic-gods")
-- 
2.41.0

From f824cfcd0db64e77715fa1a8a8f37e3e520a17c4 Mon Sep 17 00:00:00 2001
Message-ID: <f824cf[email-masked]>
In-Reply-To: <b580cf[email-masked]>
References: <b580cf[email-masked]>
From: "Artyom V. Poptsov" <[email-masked]>
Date: Wed, 17 Jan 2024 22:46:31 +0300
Subject: [PATCH 5/7] gnu: Add go-github-com-coreos-go-systemd-machine1.

* gnu/packages/golang.scm (go-github-com-coreos-go-systemd-machine1): New
  variable.

Change-Id: I2d9340a2b70dd68e24e4a88bdcd1f4c289100c6d
---
 gnu/packages/golang.scm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 2a36f6b299..860195ded1 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -8684,6 +8684,20 @@ (define-public go-github-com-coreos-go-systemd-login1
      "Go bindings to systemd for integration with the systemd logind API.")
     (license license:asl2.0)))
 
+(define-public go-github-com-coreos-go-systemd-machine1
+  (package
+    (inherit go-github-com-coreos-go-systemd-activation)
+    (name "go-github-com-coreos-go-systemd-machine1")
+    (arguments
+     '(#:tests? #f ;Tests require D-Bus daemon running.
+       #:import-path "github.com/coreos/go-systemd/machine1"
+       #:unpack-path "github.com/coreos/go-systemd"))
+    (native-inputs (list go-github-com-godbus-dbus))
+    (home-page "https://github.com/coreos/go-systemd")
+    (synopsis "Go bindings to systemd for registering machines/containers")
+    (description "Go bindings to systemd for registering machines/containers.")
+    (license license:asl2.0)))
+
 (define-public go-github-com-emirpasic-gods
   (package
     (name "go-github-com-emirpasic-gods")
-- 
2.41.0

From 9bfd2545ed69424a2934a7639bfa7fd8bcff1c4f Mon Sep 17 00:00:00 2001
Message-ID: <9bfd25[email-masked]>
In-Reply-To: <b580cf[email-masked]>
References: <b580cf[email-masked]>
From: "Artyom V. Poptsov" <[email-masked]>
Date: Wed, 17 Jan 2024 22:48:36 +0300
Subject: [PATCH 6/7] gnu: Add go-github-com-coreos-go-systemd-unit.

* gnu/packages/golang.scm (go-github-com-coreos-go-systemd-unit): New
  variable.

Change-Id: I4103a0a8a3fe8f0efe4e21b053cecda9825efdc1
---
 gnu/packages/golang.scm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 860195ded1..5b1835aca1 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -8698,6 +8698,22 @@ (define-public go-github-com-coreos-go-systemd-machine1
     (description "Go bindings to systemd for registering machines/containers.")
     (license license:asl2.0)))
 
+(define-public go-github-com-coreos-go-systemd-unit
+  (package
+    (inherit go-github-com-coreos-go-systemd-activation)
+    (name "go-github-com-coreos-go-systemd-unit")
+    (arguments
+     '(#:tests? #f ;Tests require D-Bus daemon running.
+       #:import-path "github.com/coreos/go-systemd/unit"
+       #:unpack-path "github.com/coreos/go-systemd"))
+    (native-inputs (list go-github-com-godbus-dbus))
+    (home-page "https://github.com/coreos/go-systemd")
+    (synopsis "Go bindings to systemd for working with unit files")
+    (description
+     "Go bindings to systemd for (de)serialization and comparison of unit
+files.")
+    (license license:asl2.0)))
+
 (define-public go-github-com-emirpasic-gods
   (package
     (name "go-github-com-emirpasic-gods")
-- 
2.41.0

From e8fe9949443c5b7b71e7ace257fc220d81cc89db Mon Sep 17 00:00:00 2001
Message-ID: <e8fe99[email-masked]>
In-Reply-To: <b580cf[email-masked]>
References: <b580cf[email-masked]>
From: "Artyom V. Poptsov" <[email-masked]>
Date: Mon, 29 Jan 2024 21:29:46 +0300
Subject: [PATCH 7/7] gnu: Add go-github-com-coreos-go-systemd-sdjournal.

* gnu/packages/golang.scm (go-github-com-coreos-go-systemd-sdjournal):
  New variable.

Change-Id: I48d6d6e888ab757363a16bae9f50c1ff955f287a
---
 gnu/packages/golang.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 5b1835aca1..6f5534265d 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -78,6 +78,7 @@ (define-module (gnu packages golang)
   #:use-module ((gnu packages bootstrap) #:select (glibc-dynamic-linker))
   #:use-module (gnu packages check)
   #:use-module (gnu packages fonts)
+  #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnupg)
@@ -8714,6 +8715,33 @@ (define-public go-github-com-coreos-go-systemd-unit
 files.")
     (license license:asl2.0)))
 
+(define-public go-github-com-coreos-go-systemd-sdjournal
+  (package
+    (inherit go-github-com-coreos-go-systemd-activation)
+    (name "go-github-com-coreos-go-systemd-sdjournal")
+    (arguments
+     '(#:tests? #f ;Tests require D-Bus daemon running.
+       #:import-path "github.com/coreos/go-systemd/sdjournal"
+       #:unpack-path "github.com/coreos/go-systemd"
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-sdjournal-header
+           (lambda* (#:key import-path #:allow-other-keys)
+             (substitute* (format #f
+                                  "src/~a/journal.go"
+                                  import-path)
+               (("systemd/sd-journal.h")
+                "elogind/sd-journal.h")
+               (("systemd/sd-id128.h")
+                "elogind/sd-id128.h")))))))
+    (inputs (list elogind))
+    (home-page "https://github.com/coreos/go-systemd")
+    (synopsis "Go bindings to systemd for journald")
+    (description
+     "Go bindings to systemd for reading from journald by wrapping its C
+API.")
+    (license license:asl2.0)))
+
 (define-public go-github-com-emirpasic-gods
   (package
     (name "go-github-com-emirpasic-gods")
-- 
2.41.0

The updated version of my patch set includes "sdjournal" where all
references on "systemd" package were replaced with "elogind".  Also I
rebased the patchset on "master" branch.

Thanks,
- avp

-- 
Artyom "avp" Poptsov <[email-masked]>
Home page: https://memory-heap.org/~avp/
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F