Updated dependencies, use new nix-helpers

This commit is contained in:
niten 2024-04-04 13:11:53 -07:00
parent 4a38a05d1a
commit 06c061a7ca
4 changed files with 367 additions and 361 deletions

126
build.clj
View File

@ -1,126 +0,0 @@
(ns build
(:require [clojure.tools.build.api :as b]
[clojure.pprint :refer [pprint]]
[clojure.edn :as edn]))
(def lib 'org.fudo/notifier)
(def default-version "DEV")
(defn- class-dir [{:keys [target]}] (format "%s/classes" target))
(def basis (b/create-basis {:project "deps.edn"}))
(defn- jar-file [{:keys [target version]
:or {version default-version}}]
(format "%s/%s-%s.jar" target (name lib) version))
(defn- uberjar-file [{:keys [target version]
:or {version default-version}}]
(format "%s/%s-uber-%s.jar" target (name lib) version))
(def default-params
{
:verbose false
:version "DEV"
})
(defn clean [{:keys [target] :as params}]
(b/delete {:path target})
params)
(defn compile-java [{:keys [verbose java-src] :as params}]
(when verbose (println (format "compiling java files in %s..." java-src)))
(b/javac {:src-dirs [java-src]
:class-dir (class-dir params)
:basis basis
:javac-opts ["-source" "16" "-target" "16"]})
params)
(defn compile-clj [{:keys [verbose clj-src] :as params}]
(when verbose (println (format "compiling clj files in %s..." clj-src)))
(b/compile-clj {:basis basis
:src-dirs [clj-src]
:class-dir (class-dir params)}))
(defn- read-metadata [filename]
(-> filename
(slurp)
(edn/read-string)))
(defn- process-params [base-params]
(-> base-params
(merge (read-metadata (or (:metadata base-params)
"metadata.edn")))
(update :target str)
(update :version str)
(update :java-src str)
(update :clj-src str)))
(defn jar [base-params]
(let [params (process-params base-params)
{:keys [java-src clj-src version verbose]} params
classes (class-dir params)]
(when verbose
(print "parameters: ")
(pprint params))
(compile-java params)
(compile-clj params)
(when verbose (println (format "writing POM file to %s..." classes)))
(b/write-pom {
:class-dir classes
:lib lib
:version (str version)
:basis basis
:src-dirs [java-src clj-src]
})
(when verbose (println (format "copying source files from %s to %s..."
[java-src clj-src] classes)))
(b/copy-dir {:src-dirs [java-src clj-src]
:target-dir classes})
(let [jar (jar-file params)]
(when verbose (println (format "writing JAR file to %s..." jar)))
(b/jar {:class-dir classes
:jar-file jar}))
(when verbose (println "done!"))
params))
(defn uberjar [base-params]
(let [params (process-params base-params)
{:keys [java-src clj-src version verbose]} params
classes (class-dir params)]
(when verbose
(print "parameters: ")
(pprint params))
(compile-java params)
(compile-clj params)
(when verbose (println (format "writing POM file to %s..." classes)))
(b/write-pom {
:class-dir classes
:lib lib
:version (str version)
:basis basis
:src-dirs [java-src clj-src]
})
(when verbose (println (format "copying source files from %s to %s..."
[java-src clj-src] classes)))
(b/copy-dir {:src-dirs [java-src clj-src]
:target-dir classes})
(let [uberjar (uberjar-file params)]
(when verbose (println (format "writing uberjar file to %s..." uberjar)))
(b/uber {:class-dir classes
:uber-file uberjar
:basis basis}))
(when verbose (println "done!"))
params))
(defn install [base-params]
(let [params (process-params base-params)
{:keys [version verbose]} params
target-file (jar-file params)]
(jar params)
(when verbose (println (format "installing %s..." target-file)))
(b/install {
:basis basis
:lib lib
:version (str version)
:jar-file target-file
:class-dir (class-dir params)
})
params))

File diff suppressed because it is too large Load Diff

219
flake.lock generated
View File

@ -3,18 +3,18 @@
"clj-nix": {
"inputs": {
"devshell": "devshell",
"flake-utils": "flake-utils",
"nix-fetcher-data": "nix-fetcher-data",
"nixpkgs": [
"helpers",
"nixpkgs"
]
},
"locked": {
"lastModified": 1677342613,
"narHash": "sha256-BqhKj7jQahSVThEwLHt164kJHGx9LXzBARFZaFNLPW8=",
"lastModified": 1711197542,
"narHash": "sha256-RMM+G49X56W8gE2sg08TUsuR30KcU0LNLttsSRgxTCM=",
"owner": "jlesquembre",
"repo": "clj-nix",
"rev": "7d9e244ea96988524ba3bd6c2bbafdf0a5340b96",
"rev": "20109727c6623b486d37fbd957d64c2a8232ccde",
"type": "github"
},
"original": {
@ -26,15 +26,16 @@
"clj2nix": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": "nixpkgs",
"utils": "utils"
},
"locked": {
"lastModified": 1673786922,
"narHash": "sha256-MrwSNEXpq20/AvMxW49MRbuqf8C2M4Vei3jtZeXYjJk=",
"lastModified": 1685699489,
"narHash": "sha256-QPkF7QiE0dmiqUpHmX7mBIhMCgbnZDjJG5bQ6702AOs=",
"owner": "hlolli",
"repo": "clj2nix",
"rev": "04b0dfbfc69c6316b8613d061e3fe4619d79cd9f",
"rev": "66ae6a15c3aab59cb31523e825e5270be082bfe4",
"type": "github"
},
"original": {
@ -45,23 +46,19 @@
},
"devshell": {
"inputs": {
"flake-utils": [
"helpers",
"clj-nix",
"flake-utils"
],
"nixpkgs": [
"helpers",
"clj-nix",
"nixpkgs"
]
],
"systems": "systems"
},
"locked": {
"lastModified": 1658746384,
"narHash": "sha256-CCJcoMOcXyZFrV1ag4XMTpAPjLWb4Anbv+ktXFI1ry0=",
"lastModified": 1700815693,
"narHash": "sha256-JtKZEQUzosrCwDsLgm+g6aqbP1aseUl1334OShEAS3s=",
"owner": "numtide",
"repo": "devshell",
"rev": "0ffc7937bb5e8141af03d462b468bd071eb18e1b",
"rev": "7ad1c417c87e98e56dcef7ecd0e0a2f2e5669d51",
"type": "github"
},
"original": {
@ -86,18 +83,60 @@
"type": "github"
}
},
"flake-utils": {
"flake-part": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1656928814,
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
"lastModified": 1685546676,
"narHash": "sha256-XDbjJyAg6odX5Vj0Q22iI/gQuFvEkv9kamsSbQ+npaI=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "6ef2707776c6379bc727faf3f83c0dd60b06e0c6",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1685546676,
"narHash": "sha256-XDbjJyAg6odX5Vj0Q22iI/gQuFvEkv9kamsSbQ+npaI=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "6ef2707776c6379bc727faf3f83c0dd60b06e0c6",
"type": "github"
},
"original": {
"id": "flake-parts",
"type": "indirect"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"helpers",
"clj2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1660459072,
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
@ -111,18 +150,41 @@
"utils": "utils_2"
},
"locked": {
"lastModified": 1684439334,
"narHash": "sha256-GSBblSbzl0ArXvRGn9EpjP/5j2hmu3b2IjQeY1llO08=",
"ref": "with-deps",
"rev": "b047ccd1226517e757bc8084c2cba630f4bd10b9",
"revCount": 69,
"lastModified": 1712255447,
"narHash": "sha256-Z0TBvuG0+S4CfuNORX02GHHeGJ3u0yGENtqYle2LAS4=",
"ref": "refs/heads/master",
"rev": "1d669da8f6c66ff4e71ae7e7be7681acb7420c3a",
"revCount": 107,
"type": "git",
"url": "https://git.fudo.org/fudo-public/nix-helpers.git"
"url": "https://fudo.dev/public/nix-helpers.git"
},
"original": {
"ref": "with-deps",
"type": "git",
"url": "https://git.fudo.org/fudo-public/nix-helpers.git"
"url": "https://fudo.dev/public/nix-helpers.git"
}
},
"nix-fetcher-data": {
"inputs": {
"flake-part": "flake-part",
"flake-parts": "flake-parts",
"nixpkgs": [
"helpers",
"clj-nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1685572850,
"narHash": "sha256-lYKEqFG9F84xu51H1rM1u+Ip88cINL0+W26sT+vFEZc=",
"owner": "jlesquembre",
"repo": "nix-fetcher-data",
"rev": "f14967db6c92c79b77419f52c22a698518c91120",
"type": "github"
},
"original": {
"owner": "jlesquembre",
"repo": "nix-fetcher-data",
"type": "github"
}
},
"nixpkgs": {
@ -140,18 +202,54 @@
"type": "github"
}
},
"nixpkgs_2": {
"nixpkgs-lib": {
"locked": {
"lastModified": 1684398685,
"narHash": "sha256-TRE62m91iZ5ArVMgA+uj22Yda8JoQuuhc9uwZ+NoX+0=",
"dir": "lib",
"lastModified": 1682879489,
"narHash": "sha256-sASwo8gBt7JDnOOstnps90K1wxmVfyhsTPPNTGBPjjg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "628d4bb6e9f4f0c30cfd9b23d3c1cdcec9d3cb5c",
"rev": "da45bf6ec7bbcc5d1e14d3795c025199f28e0de0",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib_2": {
"locked": {
"dir": "lib",
"lastModified": 1682879489,
"narHash": "sha256-sASwo8gBt7JDnOOstnps90K1wxmVfyhsTPPNTGBPjjg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "da45bf6ec7bbcc5d1e14d3795c025199f28e0de0",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1712168706,
"narHash": "sha256-XP24tOobf6GGElMd0ux90FEBalUtw6NkBSVh/RlA6ik=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1487bdea619e4a7a53a4590c475deabb5a9d1bfb",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-22.11",
"ref": "nixos-23.11",
"type": "indirect"
}
},
@ -177,6 +275,36 @@
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"locked": {
"lastModified": 1667395993,
@ -193,12 +321,15 @@
}
},
"utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
@ -209,14 +340,14 @@
},
"utils_3": {
"inputs": {
"systems": "systems"
"systems": "systems_3"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {

View File

@ -5,7 +5,7 @@
nixpkgs.url = "nixpkgs/nixos-23.11";
utils.url = "github:numtide/flake-utils";
helpers = {
url = "git+https://fudo.dev/public/nix-helpers.git?ref=with-deps";
url = "git+https://fudo.dev/public/nix-helpers.git";
inputs.nixpkgs.follows = "nixpkgs";
};
};
@ -19,7 +19,8 @@
notifier = helpers.packages."${system}".mkClojureLib {
name = "org.fudo/notifier";
src = ./.;
buildCommand = "clojure -T:build uberjar";
clojure-src-dirs = [ "src/clj" ];
java-src-dirs = [ "src/java" ];
};
};
@ -27,7 +28,7 @@
default = updateDeps;
updateDeps = pkgs.mkShell {
buildInputs = with helpers.packages."${system}";
[ updateClojureDeps ];
[ (updateClojureDeps { }) ];
};
};
});