aboutsummaryrefslogblamecommitdiff
path: root/src/xyz/euandreh/packages/euandreh.scm
blob: d50ba91d5beffb8f139c70ea5641c5500804416b (plain) (tree)
1
2
                                               
                     







































                                                                             
                                                          


                                                               










                                                                         
(define-module (xyz euandreh packages euandreh)
  #:use-module (json)
  #:use-module ((ice-9 textual-ports) #:prefix textual-ports:)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix transformations)
  #:use-module (guix gexp)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix utils)
  #:use-module (guix store)
  #:use-module (guix build-system gnu))

(define (read-from-store-file src name)
  (run-with-store (open-connection)
    (gexp->script "read-from-file-in-store"
      #~(string-trim-both
         (call-with-input-file
           #$(file-append src name)
           textual-ports:get-string-all)))))

(define (euandreh-package name version-prefix version hash)
  (package
    (name name)
    (version version)
    (source (origin
              (method url-fetch)
              (uri (string-append
                     "https://git.euandreh.xyz/"
                     name
                     "/snapshot/"
                     name
                     "-"
                     version-prefix
                     version
                     ".tar.gz"))
              (hash hash)))
    (build-system gnu-build-system)
    ;; This shouldn't be necessary, but
    ;; the `gnu-build-system' doesn't provide a c99 variable
    (arguments `(#:make-flags (list (string-append "CC=" ,(cc-for-target)))))
    (synopsis (file-append source "/description"))
    (description (file-append source "/long-description"))
    (home-page (string-append "https://" name ".euandreh.xyz"))
    (license license:agpl3+)))

(let* ((json-file (canonicalize-path
                   (string-append (current-source-directory)
                                  "/../../../../packages.json")))
       (packages (call-with-input-file json-file json->scm)))
  (map (lambda (package)
				 (euandreh-package
          (assoc-ref package "name")
          (assoc-ref package "version-prefix")
          (assoc-ref package "version")
          (content-hash (assoc-ref package "tarbal-sha256"))))
			 (vector->list (assoc-ref packages "packages"))))