unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#43872] [PATCH] Add package go-ethereum
@ 2020-10-08 21:59 Helio Machado
  2020-10-09 12:11 ` bug#43872: Closing due to consistency issues Helio Machado
  0 siblings, 1 reply; 5+ messages in thread
From: Helio Machado @ 2020-10-08 21:59 UTC (permalink / raw)
  To: 43872


[-- Attachment #1.1: Type: text/plain, Size: 2567 bytes --]

# Add package `go-ethereum`

These patches add the [go-ethereum][5] package and a small workaround that
allows experimental module support.

## [Checklist][1]

1. Code authentication: all the code is being pulled from Git repositories
and Go packages, so there isn't any specific code signature we can verify.

2. Synopsis and description: built from the official documentation and
around the style guidelines.

3. Results for `guix lint`: everything seems to be fine, and it seems to
have scheduled a [Software Heritage][2] archival (?).

4. Native build check: the package builds correctly on my platform
(x86-64), using `guix build` package.

5. Cross-build check: package was not tested on any other supported
platform because `go-build-system` [doesn't seem to support
cross-compilation][3].

6. Package deduplication: dependencies are being pulled from their
respective module repositories at build time; there isn't practically any
overlap between the package code and the Guix repositories.

7. Package size: as per `guix size`, this package requires a total of 418.7
MiB, with a package (self) size of 282.4 MiB.

8. Dependent packages: this is a freshly added package with no dependent
items.

9. Deterministic build: this package is fully deterministic and has fixed
hashes for both the initial download and the build derivation.

10. Inclusive language: documentation was written with neutrality in mind
and there isn't any obvious bias, though it might need proofreading.

11. Patch atomicity: this patch contains only one set of related changes,
though modifications affect two files.

12. Code formatting: added lines were formatted by using `indent-code.el`.

13. Source consistency: all the involved downloads are being pulled along
with a Git tag or commit, so results should be consistent enough.

14. Guix build: these changes don't affect Guix builds nor introduce any
warning.

15. Guix consistency: these changes do not break Guix in any obvious way.

## Desiderata

It would be great to have easier ways to replace Go module management
system with Guix in a seamless and painless way. Rust build system for Guix
has a cleaner implementation, majorly due to the existence of a
[centralized package registry][4].

[1]: https://guix.gnu.org/manual/en/html_node/Submitting-Patches.html
[2]: https://www.softwareheritage.org/
[3]:
https://git.savannah.gnu.org/cgit/guix.git/tree/guix/build-system/go.scm#n60
[4]: https://crates.io
[5]: https://github.com/ethereum/go-ethereum
[6]: https://gist.github.com/0x2b3bfa0/1805037bf5efa2655fa71d32e69fdd14

[-- Attachment #1.2: Type: text/html, Size: 3581 bytes --]

[-- Attachment #2: 0001-build-system-go-Allow-packages-to-create-fixed-outpu.patch --]
[-- Type: application/octet-stream, Size: 2079 bytes --]

From 44951639a2bd8525cc4a022b2a6d684c7bb92a30 Mon Sep 17 00:00:00 2001
From: Helio Machado <0x2b3bfa0+git@googlemail.com>
Date: Thu, 8 Oct 2020 23:28:17 +0200
Subject: [PATCH 1/2] build-system/go: Allow packages to create fixed-output
 derivations

As per the libstore source code, fixed-output derivations have
unrestricted network access as long as their contents are kept
deterministic and you provide a hash of the derivation state.
---
 guix/build-system/go.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index f8ebaefb27..baea3e5708 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -88,6 +88,9 @@
                    (allow-go-reference? #f)
                    (system (%current-system))
                    (guile #f)
+                   (derivation-hash #f)
+                   (derivation-hash-algorithm #f)
+                   (derivation-hash-recursive? #f)
                    (imported-modules %go-build-system-modules)
                    (modules '((guix build go-build-system)
                               (guix build union)
@@ -114,6 +117,9 @@
                 #:build-flags ,build-flags
                 #:tests? ,tests?
                 #:allow-go-reference? ,allow-go-reference?
+                #:derivation-hash ,derivation-hash
+                ;; FIXME  #:derivation-hash-algorithm ,derivation-hash-algorithm
+                #:derivation-hash-recursive? ,derivation-hash-recursive?
                 #:inputs %build-inputs)))
 
   (define guile-for-build
@@ -131,6 +137,9 @@
                                 #:system system
                                 #:modules imported-modules
                                 #:outputs outputs
+                                #:hash derivation-hash
+                                #:hash-algo derivation-hash-algorithm
+                                #:recursive? derivation-hash-recursive?
                                 #:guile-for-build guile-for-build))
 
 (define go-build-system
-- 
2.24.3 (Apple Git-128)


[-- Attachment #3: 0002-gnu-Add-go-github-com-ethereum-go-ethereum.patch --]
[-- Type: application/octet-stream, Size: 3842 bytes --]

From 13213667fa3e92262dc1a15b1e5a6eb0b6b0b712 Mon Sep 17 00:00:00 2001
From: Helio Machado <0x2b3bfa0+git@googlemail.com>
Date: Thu, 8 Oct 2020 23:36:10 +0200
Subject: [PATCH 2/2] gnu: Add go-github-com-ethereum-go-ethereum

* gnu/packages/golang.scm (go-github-com-ethereum-go-ethereum): new package.
---
 gnu/packages/golang.scm | 57 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index fe34d34491..ce7644bef3 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -46,6 +46,7 @@
   #:use-module (guix build-system go)
   #:use-module (gnu packages)
   #:use-module (gnu packages admin)
+  #:use-module (gnu packages certs)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages base)
@@ -477,6 +478,62 @@ jar struct to manage the cookies added to the cookie jar.")
       (home-page "https://github.com/aki237/nscjar")
       (license license:expat))))
 
+(define-public go-github-com-ethereum-go-ethereum
+  (package
+    (name "go-github-com-ethereum-go-ethereum")
+    (version "1.9.22")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/ethereum/go-ethereum")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "08i31xil2lygfcn2igsvn4hpg8xnf8l6g914f78hgl4wj6v1dja9"))))
+    (build-system go-build-system)
+    (arguments
+     `(#:import-path "github.com/ethereum/go-ethereum"
+       #:tests? #f ; tests are broken
+       #:derivation-hash ,(base32 "1ab7gd90g85ciwsrw6zjaxs76j7y0a11kavp50xkwmm26x34sjss")
+       #:derivation-hash-algorithm sha256
+       #:derivation-hash-recursive? ,#t
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'setup-go-environment 'modify-go-environment
+           (lambda _
+             (setenv "GO111MODULE" "on")
+             (setenv "SSL_CERT_DIR" (string-append
+                                     (assoc-ref %build-inputs "nss-certs")
+                                     "/etc/ssl/certs"))
+             (setenv "SSL_CERT_FILE" (string-append
+                                      (getenv "SSL_CERT_DIR")
+                                      "/ca-certificates.crt"))
+             #t))
+         (replace 'build
+           (lambda* (#:key import-path build-flags #:allow-other-keys)
+             (with-directory-excursion (string-append "src/" import-path)
+               (invoke "go" "run" "build/ci.go" "install"))))
+         (replace 'install
+           (lambda* (#:key outputs import-path #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (source (string-append (getenv "GOPATH") "/src/" import-path "/build"))
+                    (dest out))
+               (mkdir-p dest)
+               (copy-recursively source dest #:keep-mtime? #t))))
+         (replace 'check
+           (lambda* (#:key tests? import-path #:allow-other-keys)
+             (if tests?
+                 (with-directory-excursion (string-append "src/" import-path)
+                   (invoke "go" "run" "build/ci.go" "test"))
+                 #t))))))
+    (inputs `(("nss-certs" ,nss-certs)))
+    (home-page "https://github.com/ethereum/go-ethereum")
+    (synopsis "Official Go implementation of the Ethereum protocol")
+    (description "This repository contains the official Go implementation of
+the Ethereum protocol and command line tools (geth) for interacting with the blockchain.")
+    (license license:lgpl3)))
+
 (define-public go-github.com-jessevdk-go-flags
   (package
     (name "go-github.com-jessevdk-go-flags")
-- 
2.24.3 (Apple Git-128)


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#43872: Closing due to consistency issues
  2020-10-08 21:59 [bug#43872] [PATCH] Add package go-ethereum Helio Machado
@ 2020-10-09 12:11 ` Helio Machado
  2020-10-09 18:34   ` [bug#43872] " Marius Bakke
  0 siblings, 1 reply; 5+ messages in thread
From: Helio Machado @ 2020-10-09 12:11 UTC (permalink / raw)
  To: 43872-done

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

This patch was a big hack and breaks on every architecture but x86-64
because the derivation hash changes when producing different binaries. I'm
leaving this for reference as it might be useful for a casual install, but
the proper solution probably involves a complete refactoring of the Guix Go
Build System.

[-- Attachment #2: Type: text/html, Size: 336 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#43872] Closing due to consistency issues
  2020-10-09 12:11 ` bug#43872: Closing due to consistency issues Helio Machado
@ 2020-10-09 18:34   ` Marius Bakke
  2020-10-10 18:07     ` Helio Machado
  0 siblings, 1 reply; 5+ messages in thread
From: Marius Bakke @ 2020-10-09 18:34 UTC (permalink / raw)
  To: Helio Machado, 43872-done

[-- Attachment #1: Type: text/plain, Size: 1541 bytes --]

Hi!

Helio Machado <0x2b3bfa0@gmail.com> writes:

> This patch was a big hack and breaks on every architecture but x86-64
> because the derivation hash changes when producing different binaries. I'm
> leaving this for reference as it might be useful for a casual install, but
> the proper solution probably involves a complete refactoring of the Guix Go
> Build System.

That is a very clever hack.  :-)

The reason it works is because network access is allowed for
fixed-output derivations.  So the Go build system is able to go online
and download everything it needs, instead of relying on declared
inputs.  That is why different architectures produce different
derivation hashes: those are the build outputs.

The problem with this approach is that it is not deterministic.  The
next time someone runs the same build, one of the Go dependencies may
have changed (i.e. a git tag has been overwritten, or a package declares
a dependency on a branch instead of a tag, etc).

Guix will detect if the output hash changes, but is unable reproduce the
earlier state because it does not know what has changed.

To properly package go-ethereum, you will need to declare each
dependency as separate packages.  See e.g. 'syncthing' for an example.
Unfortunately there is no importer for Go yet, making it a rather
tedious task.

Since you don't seem to be afraid of hacking on Guix :-) consider
writing an "importer" for Go so you could simply:

  guix import go -r github.com/ethereum/go-ethereum

...to create the necessary boilerplate.

Thanks!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#43872] Closing due to consistency issues
  2020-10-09 18:34   ` [bug#43872] " Marius Bakke
@ 2020-10-10 18:07     ` Helio Machado
  2020-10-10 20:35       ` Marius Bakke
  0 siblings, 1 reply; 5+ messages in thread
From: Helio Machado @ 2020-10-10 18:07 UTC (permalink / raw)
  To: Marius Bakke, 43872-done


[-- Attachment #1.1: Type: text/plain, Size: 335 bytes --]

Hi!
I started yesterday to improve the Go build system and create a solid
recursive importer. It implies some structural change for every package,
but it's probably worth it and I'll submit a new patch once it's ready.
I'm attaching some internal documentation for my hack for historical
purposes.
Thank you very much for your advice!

[-- Attachment #1.2: Type: text/html, Size: 403 bytes --]

[-- Attachment #2: Guix-go-modules.md --]
[-- Type: text/markdown, Size: 14961 bytes --]

# Go modules within Guix

Using the new [Go modules][4] with the Guix package manager poses some interesting issues, as the package importer is not implemented yet and Go's own package manager clashes heavily with the Guix package manager.

I wanted to port a package without needing to follow the cumbersome process of manually importing dozens of dependencies, so the less-friction hack turned to be the repurposing of the build derivation as a deterministic downloader module, able to pull all the dependencies with the native Go package manager as if it were one of the Guix official download methods.

The suggested approach is rather unorthodox and may not be a good long-term solution: after all, it resorts to all the possible trickery to reduce changes outside of the package to a minimum.

## Network access inside the build container
[As per the `libstore` source code][0], fixed-output derivations have unrestricted network access as long as their contents are kept deterministic and you provide a hash of the final state. _Id est_, you can gather files from a remote repository as long as you're able to get the same commit or version every time.

> _When `hash` and `hash-algo` are given, a fixed-output derivation is created —i.e., one whose result is known in advance, such as a file download. If, in addition, `recursive?`` is true, then that fixed output may be an executable file or a directory and hash must be the hash of an archive containing this output. [(Source)][1]_

By extending [`guix/build-system/go.scm`][2], we can pass through three additional keyword arguments to `build-expression->derivation` specifying the derivation hash:

```patch
diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index f8ebaefb27..f6b6a7809d 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -88,6 +88,9 @@
                    (allow-go-reference? #f)
                    (system (%current-system))
                    (guile #f)
+                   (derivation-hash #f)
+                   (derivation-hash-algorithm #f)
+                   (derivation-hash-recursive? #f)
                    (imported-modules %go-build-system-modules)
                    (modules '((guix build go-build-system)
                               (guix build union)
@@ -114,6 +117,9 @@
                 #:build-flags ,build-flags
                 #:tests? ,tests?
                 #:allow-go-reference? ,allow-go-reference?
+                #:derivation-hash ,derivation-hash
+                ; #:derivation-hash-algorithm ,derivation-hash-algorithm ; FIXME
+                #:derivation-hash-recursive? ,derivation-hash-recursive?
                 #:inputs %build-inputs)))

   (define guile-for-build
@@ -131,6 +137,9 @@
                                 #:system system
                                 #:modules imported-modules
                                 #:outputs outputs
+                                #:hash derivation-hash
+                                #:hash-algo derivation-hash-algorithm
+                                #:recursive? derivation-hash-recursive?
                                 #:guile-for-build guile-for-build))

 (define go-build-system
```

This way, any package can create a fixed-output build derivation with network access in order to pull additional files during the build process without breaking the build determinism:

```scheme
(package
  (build-system go-build-system)
  (arguments
    (#:derivation-hash (base32 "···")
     #:derivation-hash-algorithm 'sha256
     #:derivation-hash-recursive? #t)))
```

## X509 certificates for network requests

Once we introduce networking capabilities inside the container, we need to provision it with certificates so it's able to authenticate secure connections to the outside world. In order to achieve this, we would need to include the `certs` package first:

```patch
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index fe34d34491..03f8959b7f 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -46,6 +46,7 @@
   #:use-module (guix build-system go)
   #:use-module (gnu packages)
   #:use-module (gnu packages admin)
+  #:use-module (gnu packages certs)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages base)
```

Then, we can include the certificate bundle at the package level through the `inputs` keyword argument:

```scheme
(package
  (build-system go-build-system)
  (inputs `(("nss-certs" ,nss-certs))))
```

Additionally, we're going to need a few environment variables pointing to the actual certificate directory, because it won't be at the standard location:

```scheme
(package
  (build-system go-build-system)
  (arguments
   `(#:phases
      (modify-phases %standard-phases
        (add-after 'setup-go-environment 'add-certificates
          (lambda _
            (setenv "SSL_CERT_DIR" (string-append
              (assoc-ref %build-inputs "nss-certs")
              "/etc/ssl/certs"))
            (setenv "SSL_CERT_FILE" (string-append
              (getenv "SSL_CERT_DIR")
              "/ca-certificates.crt"))
            #t))))))
```

## Support for the new module system

Now, we need to enable the new module system through the `GO111MODULE` environment variable, as it's being disabled by default from [`guix/build/go-build-system.scm`][3] due to the previous lack of support. As this proposal is highly experimental and every package expects it set to `off`, it's probably better to toggle it on an the package level:

```scheme
(package
  (build-system go-build-system)
  (arguments
   `(#:phases
      (modify-phases %standard-phases
        (add-after 'setup-go-environment 'enable-modules
          (lambda _
            (setenv "GO111MODULE" "on")
            #t))))))
```

## Example package: `go-ethereum`

```scheme
(define-public go-github-com-ethereum-go-ethereum
  (package
    (name "go-github-com-ethereum-go-ethereum")
    (version "1.9.22")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/ethereum/go-ethereum")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "08i31xil2lygfcn2igsvn4hpg8xnf8l6g914f78hgl4wj6v1dja9"))))
    (build-system go-build-system)
    (arguments
     `(#:import-path "github.com/ethereum/go-ethereum"
       #:tests? #f ; tests are broken
       #:derivation-hash ,(base32 "1ab7gd90g85ciwsrw6zjaxs76j7y0a11kavp50xkwmm26x34sjss")
       #:derivation-hash-algorithm sha256
       #:derivation-hash-recursive? ,#t
       #:phases
       (modify-phases %standard-phases
         (add-after 'setup-go-environment 'modify-go-environment
           (lambda _
             (setenv "GO111MODULE" "on")
             (setenv "SSL_CERT_DIR" (string-append
               (assoc-ref %build-inputs "nss-certs")
               "/etc/ssl/certs"))
             (setenv "SSL_CERT_FILE" (string-append
               (getenv "SSL_CERT_DIR")
               "/ca-certificates.crt"))
             #t))
         (replace 'build
           (lambda* (#:key import-path build-flags #:allow-other-keys)
             (with-directory-excursion (string-append "src/" import-path)
               (invoke "go" "run" "build/ci.go" "install"))))
         (replace 'install
           (lambda* (#:key outputs import-path #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
               (source (string-append (getenv "GOPATH") "/src/" import-path "/build"))
               (dest out))
             (mkdir-p dest)
             (copy-recursively source dest #:keep-mtime? #t))))
         (replace 'check
           (lambda* (#:key tests? import-path #:allow-other-keys)
             (if tests?
               (with-directory-excursion (string-append "src/" import-path)
                 (invoke "go" "run" "build/ci.go" "test"))
               #t))))))
    (inputs `(("nss-certs" ,nss-certs)))
    (home-page "https://github.com/ethereum/go-ethereum")
    (synopsis "Official Go implementation of the Ethereum protocol")
    (description "This repository contains the official
Go implementation of the Ethereum protocol and command
line tools for interacting with the blockchain.")
    (license license:lgpl3)))
```

## Full patches, ready to apply

```patch
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index fe34d34491..85c368942b 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -46,6 +46,7 @@
   #:use-module (guix build-system go)
   #:use-module (gnu packages)
   #:use-module (gnu packages admin)
+  #:use-module (gnu packages certs)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages base)
@@ -933,6 +934,62 @@ time.")
 is similar to Go's standard library @code{json} and @code{xml} package.")
     (license license:expat)))

+(define-public go-github-com-ethereum-go-ethereum
+  (package
+    (name "go-github-com-ethereum-go-ethereum")
+    (version "1.9.22")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/ethereum/go-ethereum")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "08i31xil2lygfcn2igsvn4hpg8xnf8l6g914f78hgl4wj6v1dja9"))))
+    (build-system go-build-system)
+    (arguments
+     `(#:import-path "github.com/ethereum/go-ethereum"
+       #:tests? #f ; tests are broken
+       #:derivation-hash ,(base32 "1ab7gd90g85ciwsrw6zjaxs76j7y0a11kavp50xkwmm26x34sjss")
+       #:derivation-hash-algorithm sha256
+       #:derivation-hash-recursive? ,#t
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'setup-go-environment 'modify-go-environment
+           (lambda _
+             (setenv "GO111MODULE" "on")
+             (setenv "SSL_CERT_DIR" (string-append
+               (assoc-ref %build-inputs "nss-certs")
+               "/etc/ssl/certs"))
+             (setenv "SSL_CERT_FILE" (string-append
+               (getenv "SSL_CERT_DIR")
+               "/ca-certificates.crt"))
+             #t))
+         (replace 'build
+           (lambda* (#:key import-path build-flags #:allow-other-keys)
+             (with-directory-excursion (string-append "src/" import-path)
+               (invoke "go" "run" "build/ci.go" "install"))))
+         (replace 'install
+           (lambda* (#:key outputs import-path #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+               (source (string-append (getenv "GOPATH") "/src/" import-path "/build"))
+               (dest out))
+             (mkdir-p dest)
+             (copy-recursively source dest #:keep-mtime? #t))))
+         (replace 'check
+           (lambda* (#:key tests? import-path #:allow-other-keys)
+             (if tests?
+               (with-directory-excursion (string-append "src/" import-path)
+                 (invoke "go" "run" "build/ci.go" "test"))
+               #t))))))
+    (inputs `(("nss-certs" ,nss-certs)))
+    (home-page "https://github.com/ethereum/go-ethereum")
+    (synopsis "Official Go implementation of the Ethereum protocol")
+    (description "This repository contains the official Go implementation of
+the Ethereum protocol and command line tools for interacting with the blockchain.")
+    (license license:lgpl3)))
+
 (define-public go-github-com-getsentry-raven-go
   (let ((commit "5c24d5110e0e198d9ae16f1f3465366085001d92")
         (revision "0"))
```

```patch
diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm
index f8ebaefb27..e8743e3929 100644
--- a/guix/build-system/go.scm
+++ b/guix/build-system/go.scm
@@ -88,6 +88,9 @@
                    (allow-go-reference? #f)
                    (system (%current-system))
                    (guile #f)
+                   (derivation-hash #f)
+                   (derivation-hash-algorithm #f)
+                   (derivation-hash-recursive? #f)
                    (imported-modules %go-build-system-modules)
                    (modules '((guix build go-build-system)
                               (guix build union)
@@ -114,6 +117,9 @@
                 #:build-flags ,build-flags
                 #:tests? ,tests?
                 #:allow-go-reference? ,allow-go-reference?
+                #:derivation-hash ,derivation-hash
+                ; FIXME #:derivation-hash-algorithm ,derivation-hash-algorithm
+                #:derivation-hash-recursive? ,derivation-hash-recursive?
                 #:inputs %build-inputs)))

   (define guile-for-build
@@ -131,6 +137,9 @@
                                 #:system system
                                 #:modules imported-modules
                                 #:outputs outputs
+                                #:hash derivation-hash
+                                #:hash-algo derivation-hash-algorithm
+                                #:recursive? derivation-hash-recursive?
                                 #:guile-for-build guile-for-build))

 (define go-build-system
```

## Pending loose ends

* I've been unable to uncomment the `FIXME` line at `guix/build-system/go.scm` without getting an undecipherable [for me] stack trace. This should be fixed to keep compatibility with other hashing algorithms.

* We're only installing the built binary packages to the root of the derivation output, but there might be more interesting build artifacts to be added to use this package as a module.


# Guix testing environment

I'm documenting my recipe for creating a testing environment from a clean install.

## Upgrading the system
```bash
export PATH="/home/$USER/.config/guix/current/bin:$PATH"
```
```bash
guix pull
hash guix
guix pull
```
```bash
GUIX_PROFILE="/home/$USER/.guix-profile"
source "$GUIX_PROFILE/etc/profile"
```

## Installing the build dependencies
```bash
guix install git autoconf automake gettext texinfo graphviz help2man
```

## Getting the source code
```bash
git clone https://git.savannah.gnu.org/git/guix.git
cd guix
```

## Entering inside a container
```bash
guix environment guix --pure
```

## Setting up the project
```bash
./bootstrap
./configure --localstatedir=/var
make
```

## Sourcing `guix` profile inside the container
```bash
GUIX_PROFILE="/home/$USER/.guix-profile"
source "$GUIX_PROFILE/etc/profile"
```

## Running commands
```bash
./pre-inst-env guix --version
```

[0]: https://git.savannah.gnu.org/cgit/guix.git/tree/nix/libstore/build.cc#n1915
[1]: https://guix.gnu.org/manual/en/html_node/Derivations.html
[2]: https://git.savannah.gnu.org/cgit/guix.git/tree/guix/build-system/go.scm#n129
[3]: https://git.savannah.gnu.org/cgit/guix.git/tree/guix/build/go-build-system.scm#n149
[4]: https://blog.golang.org/using-go-modules

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [bug#43872] Closing due to consistency issues
  2020-10-10 18:07     ` Helio Machado
@ 2020-10-10 20:35       ` Marius Bakke
  0 siblings, 0 replies; 5+ messages in thread
From: Marius Bakke @ 2020-10-10 20:35 UTC (permalink / raw)
  To: Helio Machado, 43872-done

[-- Attachment #1: Type: text/plain, Size: 535 bytes --]

Helio Machado <0x2b3bfa0@gmail.com> writes:

> Hi!
> I started yesterday to improve the Go build system and create a solid
> recursive importer. It implies some structural change for every package,
> but it's probably worth it and I'll submit a new patch once it's ready.

Exciting, good luck on the journey.  Importers are decoupled from
build systems, so I'm curious what structural changes are imposed.

Feel free to drop by the #guix IRC channel on Freenode for
up-to-the-minute feedback.  :-)

Thanks a lot for diving into this!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-10 20:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-08 21:59 [bug#43872] [PATCH] Add package go-ethereum Helio Machado
2020-10-09 12:11 ` bug#43872: Closing due to consistency issues Helio Machado
2020-10-09 18:34   ` [bug#43872] " Marius Bakke
2020-10-10 18:07     ` Helio Machado
2020-10-10 20:35       ` Marius Bakke

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).