about summary refs log tree commit diff
path: root/third_party/dfmt
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-10-14T22·08+0200
committertazjin <mail@tazj.in>2021-10-15T11·51+0000
commit67ec19e854efd2f1e1161c60abd2424aeb95a1ac (patch)
treeadb99d2729118afe9e13feeafdad69ede1e8b26f /third_party/dfmt
parent465c9e72570caf054a9729cf3844d70cb689d0e1 (diff)
feat(3p/dfmt): Add derivation for the D code formatter r/2972
Change-Id: I4e06676f45df334db4fbc4f1657a6f16828547dc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3727
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'third_party/dfmt')
-rw-r--r--third_party/dfmt/default.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/third_party/dfmt/default.nix b/third_party/dfmt/default.nix
new file mode 100644
index 000000000000..6444940ab017
--- /dev/null
+++ b/third_party/dfmt/default.nix
@@ -0,0 +1,35 @@
+# dfmt is a code formatter for D
+{ pkgs, lib, ... }:
+
+pkgs.stdenv.mkDerivation rec {
+  pname = "dfmt";
+  version = "0.13.4";
+
+  src = pkgs.fetchFromGitHub {
+    owner = "dlang-community";
+    repo = "dfmt";
+    rev = "v${version}";
+    sha256 = "02a8qvrmnl1c15y6irxlhqpr0hjj5s8qk0jc20ivj0fl6p4v9shj";
+    fetchSubmodules = true;
+  };
+
+  nativeBuildInputs = with pkgs; [
+    dmd
+
+    # fake git that will be used to fetch the version string
+    (pkgs.writeShellScriptBin "git" ''
+      echo 'v${version}'
+    '')
+  ];
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp bin/dfmt $out/bin/
+  '';
+
+  meta = {
+    description = "D code formatter";
+    homepage = "https://github.com/dlang-community/dfmt";
+    license = lib.licenses.boost;
+  };
+}