rekahsoft-gnu: Patch terraform sources to read GUIX_TERRAFORM_PLUGIN_DIR variable

Additionally, propagate the GUIX_TERRAFORM_PLUGIN_DIR variable so that only
guix installed terraform providers can be used. This has the effect of
disabling automatic fetching of terraform providers, which may be inconvenient
to those who are not expecting this behavior. On Nix, this is resolved by not
using a shim shell script that sets this variable when no terraform providers
are installed. This approach doesn't work very well on guix, so in the future
separate packages which inherit from the existing terraform packages but do
not set this environment variable may be provided.
This commit is contained in:
Collin J. Doering 2021-12-06 14:37:34 -05:00
parent e0f13a9819
commit 9915757715
Signed by: rekahsoft
GPG Key ID: 7B4DEB93212B3022
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,16 @@
diff --git a/command/init.go b/command/init.go
index 403ca245b..05d98329a 100644
--- a/command/init.go
+++ b/command/init.go
@@ -64,6 +64,11 @@ func (c *InitCommand) Run(args []string) int {
return 1
}
+ val, ok := os.LookupEnv("GUIX_TERRAFORM_PLUGIN_DIR")
+ if ok {
+ flagPluginPath = append(flagPluginPath, val)
+ }
+
if len(flagPluginPath) > 0 {
c.pluginPath = flagPluginPath
c.getPlugins = false

View File

@ -18,6 +18,7 @@
(define-module (rekahsoft-gnu packages terraform) (define-module (rekahsoft-gnu packages terraform)
#:use-module ((guix licenses) #:prefix license:) #:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages)
#:use-module (gnu packages golang) #:use-module (gnu packages golang)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (guix packages) #:use-module (guix packages)
@ -27,6 +28,14 @@
#:use-module (guix build-system trivial) #:use-module (guix build-system trivial)
#:use-module (rekahsoft-gnu packages golang)) #:use-module (rekahsoft-gnu packages golang))
(define (search-rekahsoft-gnu-patches patch)
(parameterize
((%patch-path
(map (lambda (directory)
(string-append directory "/rekahsoft-gnu/packages/patches"))
%load-path)))
(search-patches patch)))
;; TODO: Uses vendored dependencies ;; TODO: Uses vendored dependencies
(define-public terraform-0.13 (define-public terraform-0.13
(package (package
@ -37,6 +46,7 @@
(uri (git-reference (uri (git-reference
(url "https://github.com/hashicorp/terraform") (url "https://github.com/hashicorp/terraform")
(commit (string-append "v" version)))) (commit (string-append "v" version))))
(patches (search-rekahsoft-gnu-patches "terraform-provider-path.patch"))
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 (base32
@ -53,7 +63,11 @@
(variable "SSL_CERT_FILE") (variable "SSL_CERT_FILE")
(file-type 'regular) (file-type 'regular)
(separator #f) ;single entry (separator #f) ;single entry
(files '("etc/ssl/certs/ca-certificates.crt"))))) (files '("etc/ssl/certs/ca-certificates.crt")))
(search-path-specification
(variable "GUIX_TERRAFORM_PLUGIN_DIR")
(separator #f) ;single entry
(files '("libexec/terraform")))))
(arguments (arguments
`(#:import-path "github.com/hashicorp/terraform" `(#:import-path "github.com/hashicorp/terraform"
#:install-source? #f #:install-source? #f
@ -106,6 +120,7 @@ popular service providers as well as custom in-house solutions.")
(uri (git-reference (uri (git-reference
(url "https://github.com/hashicorp/terraform") (url "https://github.com/hashicorp/terraform")
(commit (string-append "v" version)))) (commit (string-append "v" version))))
(patches (search-rekahsoft-gnu-patches "terraform-provider-path.patch"))
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 (base32
@ -120,6 +135,7 @@ popular service providers as well as custom in-house solutions.")
(uri (git-reference (uri (git-reference
(url "https://github.com/hashicorp/terraform") (url "https://github.com/hashicorp/terraform")
(commit (string-append "v" version)))) (commit (string-append "v" version))))
(patches (search-rekahsoft-gnu-patches "terraform-provider-path.patch"))
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 (base32