Skip to content

Instantly share code, notes, and snippets.

@dakra
Created July 24, 2024 16:09
Show Gist options
  • Save dakra/8bd7bd20a8c117b44bb4a85c7913dac4 to your computer and use it in GitHub Desktop.
Save dakra/8bd7bd20a8c117b44bb4a85c7913dac4 to your computer and use it in GitHub Desktop.
Home .clojure/deps.edn config (from https://github.com/seancorfield/dot-clojure)
;; Some stuff from https://github.com/seancorfield/dot-clojure
;;
;; The deps.edn file describes the information needed to build a classpath.
;;
;; When using the `clojure` or `clj` script, there are several deps.edn files
;; that are combined:
;; - install-level
;; - user level (this file)
;; - project level (current directory when invoked)
;;
;; For all attributes other than :paths, these config files are merged left to right.
;; Only the last :paths is kept and others are dropped.
{
;; Paths
;; Directories in the current project to include in the classpath
;; :paths ["src"]
;; Extra repositories
;; For cognitec dev-tools, also see credentials in ~/.m2/settings.xml
:mvn/repos {"cognitect-dev-tools" {:url "https://dev-tools.cognitect.com/maven/releases/"}
;; "datomic-cloud" {:url "s3://datomic-releases-1fc2183a/maven/releases"}
"sonatype" {:url "https://oss.sonatype.org/content/repositories/snapshots/"}}
;; Aliases
;; resolve-deps aliases (-R) affect dependency resolution, options:
;; :extra-deps - specifies extra deps to add to :deps
;; :override-deps - specifies a coordinate to use instead of that in :deps
;; :default-deps - specifies a coordinate to use for a lib if one isn't found
;; make-classpath aliases (-C) affect the classpath generation, options:
;; :extra-paths - vector of additional paths to add to the classpath
;; :classpath-overrides - map of lib to path that overrides the result of resolving deps
;; :aliases {
;; :deps {:extra-deps {org.clojure/tools.deps.alpha {:mvn/version "0.5.435"}}}
;; :test {:extra-paths ["test"]}
;; }
:aliases
{:graph {:deps {org.clojure/tools.deps.graph {:mvn/version "1.1.68"}}
:main-opts ["-m" "clojure.tools.deps.graph"]}
;; - see https://github.com/liquidz/antq
:outdated {:replace-deps {com.github.liquidz/antq {:mvn/version "RELEASE"}}
:main-opts ["-m" "antq.core"]}
:ion-dev {:deps {com.cognitect/transit-clj {:mvn/version "1.0.329"} ;; For custom #uri data_reader
com.datomic/ion-dev {:mvn/version "1.0.306"}}
:main-opts ["-m" "datomic.ion.dev"]}
;; uberjar building:
;; - see https://github.com/seancorfield/depstar for a minimalist approach:
;; - clj -X:uberjar :jar result.jar :main-class mymain.namespace
;; - to run it:
;; - java -jar result.jar
;; - build a library JAR:
;; - clj -X:jar :jar result-lib.jar
:uberjar {:extra-deps {com.github.seancorfield/depstar {:mvn/version "RELEASE"}}
:exec-fn hf.depstar/uberjar
:exec-args {:aot true}}
:jar {:extra-deps {com.github.seancorfield/depstar {:mvn/version "RELEASE"}}
:exec-fn hf.depstar/jar
:exec-args {}}
;; https://github.com/lambdaisland/classpath
;; Add dependencies to the classpath without restarting the repl
:licp {:extra-deps {com.lambdaisland/classpath {:mvn/version "0.5.48"}}}
;; This need dir-local file like
;; ((nil . ((cider-clojure-cli-global-options . "-A:dev")
;; (cider-clojure-cli-parameters . "-J-Dvlaaad.reveal.prefs='{:font-family \"file:/home/daniel/misc/operator-mono/OperatorMono-Medium.otf\" :font-size 25}' -m nrepl.cmdline --middleware '%s'"))))
;; and
;; Inject reveal middleware in cider-jack-in
;; (add-to-list 'cider-jack-in-nrepl-middlewares "vlaaad.reveal.nrepl/middleware" t)
:reveal-old {:extra-deps {vlaaad/reveal {:mvn/version "RELEASE"}}
:jvm-opts ["-Dvlaaad.reveal.prefs={:theme,:dark,:font-family,\"file:/home/daniel/misc/operator-mono/OperatorMono-Medium.otf\",:font-size,15}"]}
:reveal {:extra-deps {vlaaad/reveal {:mvn/version "RELEASE"}}
:ns-default vlaaad.reveal
:exec-fn repl}
:morse {:extra-deps {io.github.nubank/morse {:git/tag "v2023.04.27.01" :git/sha "7a85e46"}}}
:portal {:extra-deps {djblue/portal {:mvn/version "RELEASE"}}}
;; :portal {:extra-deps {djblue/portal {:mvn/version "RELEASE"}}
;; :main-opts ["-m" "nrepl.cmdline"
;; "--middleware"
;; "[cider.nrepl/cider-middleware,portal.nrepl/wrap-portal]"]}
;; Then in user.clj
;; (require '[flow-storm.api :as fs-api])
;; (fs-api/local-connect) ;; will run the debbuger GUI and get everything ready
;; And instrument with #rtrace #trace #ctrace annotations
:flow-storm {:extra-deps {com.github.jpmonettas/flow-storm-dbg {:mvn/version "RELEASE"}
com.github.jpmonettas/flow-storm-inst {:mvn/version "RELEASE"}}}
;; project creation from templates:
;; - see https://github.com/seancorfield/clj-new
;; - create an application project:
;; - clj -X:new :template app :name myname/myapp
;; - cd myapp
;; - clj -M -m myname.myapp # run it!
;; - clj -M:test:runner # run the tests!
;; - create a library project:
;; - clj -X:new :name myname/my-cool-lib
;; - cd my-cool-lib
;; - clj -M:test:runner # run the tests!
:new {:extra-deps {com.github.seancorfield/clj-new {:mvn/version "RELEASE"}}
:exec-fn clj-new/create
:exec-args {:template lib}}}
;; Provider attributes
;; :mvn/repos {
;; "central" {:url "https://repo1.maven.org/maven2/"}
;; "clojars" {:url "https://repo.clojars.org/"}
;; }
;; https://github.com/vvvvalvalval/scope-capture
;; Call (sc.api/spy ,,,)
;; Then (sc.nrepl.repl/in-ep 7)
;; to switch context and
;; (sc.nrepl.repl/exit) to exit
:scope-caputure
{:extra-deps {vvvvalvalval/scope-capture-nrepl {:mvn/version "RELEASE"}}}
;; Convert Leiningen projects to Clojure CLI tools with depify
:project/depify
{:extra-deps {depify/depify {:git/url "https://github.com/hagmonk/depify"
:sha "b3f61517c860518c1990133aa6eb54caf1e4d591"}}
:main-opts ["-m" "depify.project"]}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment