diff mbox series

[bug#65131,25/32] gnu: Add vagrant-cachier.

Message ID aa0793e6ba052c148b37e687b46bf907a7d51da1.1691432343.git.h.goebel@crazy-compilers.com
State New
Headers show
Series Add vagrant, some vagrant plugins and required ruby modules | expand

Commit Message

Hartmut Goebel Aug. 7, 2023, 6:26 p.m. UTC
* gnu/packages/virtualization.scm (vagrant-cachier): New variable.
---
 gnu/packages/virtualization.scm | 50 +++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index d37844904c..c3d5bef58b 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -2325,6 +2325,56 @@  conflicts when running on a `foreign distribution'.")
     (home-page "https://www.vagrantup.com")
     (license license:bsd-3)))
 
+(define-public vagrant-cachier
+  (package
+    (name "vagrant-cachier")
+    (version "1.2.1")
+    (source (origin
+              (method url-fetch)
+              (uri (rubygems-uri "vagrant-cachier" version))
+              (sha256
+               (base32
+                "0v11nf2d2y2knwm4zackd5ap8h2927n8rc1q73b6ii4hndv98fh9"))))
+    (build-system ruby-build-system)
+    (arguments
+     (list
+      #:tests? #f ; neither gem nor source actually has tests
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'install 'install-plugin.json
+            (lambda _
+              (let* ((plugins.d (string-append
+                                 #$output "/share/vagrant-plugins/plugins.d"))
+                     (plugin.json (string-append
+                                   plugins.d "/" #$name ".json")))
+                (mkdir-p plugins.d)
+                #$(with-extensions (list guile-json-4)
+                    #~(begin
+                        (use-modules (json))
+                        (call-with-output-file plugin.json
+                          (lambda (port)
+                            (scm->json
+                             '((#$name
+                                .
+                                (("ruby_version"
+                                  . #$(package-version (this-package-input "ruby")))
+                                 ("vagrant_version"
+                                  . #$(package-version (this-package-input "vagrant")))
+                                 ("gem_version" .  "")
+                                 ("require" . "")
+                                 ("installed_gem_version" . #$version)
+                                 ("sources" . #()))))
+                             port)))))))))))
+    (inputs (list ruby vagrant))
+    (synopsis "Share a common package cache among similar VM instances")
+    (description "This package provides a Vagrant plugin that helps you reduce
+the amount of coffee you drink while waiting for boxes to be provisioned by
+sharing a common package cache among similar VM instances.  Kinda like
+vagrant-apt_cache or this magical snippet but targeting multiple package
+managers and Linux distros.")
+    (home-page "https://github.com/fgrehm/vagrant-cachier")
+    (license license:expat)))
+
 (define-public vagrant-vai
   (package
     (name "vagrant-vai")