From cf2dd19b5f79c8c9af809c57cf3f2260c929bd97 Mon Sep 17 00:00:00 2001 From: niten Date: Mon, 30 May 2022 16:09:14 -0700 Subject: [PATCH] Use new to-edn function to generate config. --- flake.lock | 40 +++++++++++++++++++++++++++++++++++++--- flake.nix | 10 +++++++--- mkClojureLib.nix | 13 +++++++++---- 3 files changed, 53 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index 7f20b7e..f0c1622 100644 --- a/flake.lock +++ b/flake.lock @@ -102,15 +102,49 @@ "type": "indirect" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1645296114, + "narHash": "sha256-y53N7TyIkXsjMpOG7RhvqJFGDacLs9HlyHeSTBioqYU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "530a53dcbc9437363471167a5e4762c5fcfa34a1", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-21.05", + "type": "indirect" + } + }, "root": { "inputs": { "build-tools-src": "build-tools-src", "clj2nix": "clj2nix", "gitignore": "gitignore", "nixpkgs": "nixpkgs_2", + "to-edn": "to-edn", "utils": "utils_2" } }, + "to-edn": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1653952083, + "narHash": "sha256-kmPtkcrbS6UtyjXdRWPnqQ0PFney+pPjpgYn3mLV28Y=", + "ref": "master", + "rev": "1fdfabc55c600c121fda29f4d7764fee56fbb958", + "revCount": 3, + "type": "git", + "url": "https://git.fudo.org/fudo-public/to-edn.git" + }, + "original": { + "type": "git", + "url": "https://git.fudo.org/fudo-public/to-edn.git" + } + }, "utils": { "locked": { "lastModified": 1637014545, @@ -128,11 +162,11 @@ }, "utils_2": { "locked": { - "lastModified": 1652776076, - "narHash": "sha256-gzTw/v1vj4dOVbpBSJX4J0DwUR6LIyXo7/SuuTJp1kM=", + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "04c1b180862888302ddfb2e3ad9eaa63afc60cf8", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 690c45c..73554a1 100644 --- a/flake.nix +++ b/flake.nix @@ -13,9 +13,11 @@ url = "github:hercules-ci/gitignore.nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + to-edn.url = "git+https://git.fudo.org/fudo-public/to-edn.git"; }; - outputs = { self, nixpkgs, utils, clj2nix, build-tools-src, gitignore, ... }: + outputs = + { self, nixpkgs, utils, clj2nix, build-tools-src, gitignore, to-edn, ... }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages."${system}"; @@ -25,8 +27,10 @@ }; in { lib = { - mkClojureLib = - pkgs.callPackage ./mkClojureLib.nix { inherit build-tools-jar; }; + mkClojureLib = pkgs.callPackage ./mkClojureLib.nix { + inherit build-tools-jar; + inherit (to-edn.lib) toEDN; + }; }; devShell."${system}" = pkgs.mkShell { buildInputs = with pkgs; [ clojure clj2nix ]; }; diff --git a/mkClojureLib.nix b/mkClojureLib.nix index 63d325a..554a605 100644 --- a/mkClojureLib.nix +++ b/mkClojureLib.nix @@ -1,11 +1,16 @@ -{ lib, stdenv, callPackage, clojure, build-tools-jar, writeText }: +{ lib, stdenv, callPackage, clojure, build-tools-jar, writeText, toEDN }: { src, name, group, version, clj-deps, src-paths }: with lib; let - build-tools-deps = '' - { :aliases { :build { :ns-build build :replace-deps { io.github.clojure/tools.build { :local/root "${build-tools-jar}" } } } } }''; + build-tools-deps = toEDN { + aliases.build = { + ns-build = "'build"; + replace-deps."'io.github.clojure/tools.build"."local/root" = + "${build-tools-jar}"; + }; + }; classpath = clj-deps.makeClasspaths { }; @@ -28,7 +33,7 @@ in stdenv.mkDerivation { clojure \ -Scp .:${build-tools-jar}:${classpath} \ - -Sdeps ${build-tools-deps} \ + -Sdeps ${builtins.trace build-tools-deps build-tools-deps} \ -X:build \ lib-uberjar \ :project ${group}/${name} \