Subject: [PATCH] Add leiningen

From: Przemysław Kamiński <[email-masked]>
Date: Wed, 26 Jul 2023 13:21:39 +0000

Hello,

I did take a look at what Nix does and apparently one should use
lein-pkg instead of lein and perform some regexp replaces.

Here's what I have, but it doesn't work since my Guix knowledge is too
small (I added comments where appropriate, also I think it's better to
use Codeberg than GitHub):

```
(use-modules (guix)
             (guix download)
             ((guix licenses) #:prefix license:)
             (guix packages)
             (guix build-system ant)
             (guix build-system copy)
             (gnu packages clojure)
             (gnu packages wget))

(define-public leiningen-jar-standalone
  ;; 1. fetch https://codeberg.org/attachments/43cebda5-a7c2-405b-b641-5143a00051b5 (leiningen-2.10.0-standalone.jar)
  (package
    (name "leiningen-jar-standalone")
    (version "2.10.0")
    (source (origin
             (method url-fetch)
             (uri (string-append "https://codeberg.org/attachments/43cebda5-a7c2-405b-b641-5143a00051b5"))
             (file-name (string-append "leiningen-" version "-standalone.jar"))
             (sha256
              (base32
               "0d5vmpyp9ddxpj1s5c60fv2f5iimz1chbgfhchlaqxa0sfx9jwnj"))))
    (build-system copy-build-system)
    (home-page "https://leiningen.org")
    (synopsis "Automating Clojure projects without setting your hair on fire")
    (description "Leiningen is the easiest way to use Clojure.  With a focus
on project automation and declarative configuration, it gets out of your way
and lets you focus on your code.")
    (license license:epl1.0)))

(define-public leiningen
  (package
    (name "leiningen")
    (version "2.10.0")
    (source (origin
             (method url-fetch/tarbomb)
             ;; https://codeberg.org/leiningen/leiningen/archive/2.10.0.zip
             (uri (string-append
                   "https://codeberg.org/leiningen/"
                   name "/archive/" version ".tar.gz"))
              (sha256
               (base32
                "0hxp8qlxcn7svskvvhalyk0ajaqd56nma03vq96w7d2ajghdn13b"))))
    (build-system ant-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (delete 'configure)
         (delete 'build)
         (delete 'check)
    ;; TODO
    ;; 2. replace 'LEIN_JAR=/usr/share/java/leiningen-$LEIN_VERSION-standalone.jar' "LEIN_JAR=$out/share/$JARNAME"
    ;; 3 . wrapProgram $out/bin/lein
    ;;       --prefix PATH ":" "${lib.makeBinPath [ rlwrap coreutils ]}"
    ;;       --set LEIN_GPG ${gnupg}/bin/gpg
    ;;       --set JAVA_CMD ${jdk}/bin/java
         (replace 'install
                  (lambda* (#:key outputs #:allow-other-keys)
                           (install-file (string-append
                                          ,name "/bin/lein-pkg")
                                         (string-append
                                          (assoc-ref outputs "out") "/bin/lein")))))))
    (native-inputs (list leiningen-jar-standalone))
    ;; (build-inputs (list clojure clojure-tools))
    (home-page "https://leiningen.org")
    (synopsis "Automating Clojure projects without setting your hair on fire")
    (description "Leiningen is the easiest way to use Clojure.  With a focus
on project automation and declarative configuration, it gets out of your way
and lets you focus on your code.")
    (license license:epl1.0)))

leiningen
```