about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--third_party/dfmt/default.nix35
-rw-r--r--users/tazjin/nixos/tverskoy/default.nix2
2 files changed, 36 insertions, 1 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;
+  };
+}
diff --git a/users/tazjin/nixos/tverskoy/default.nix b/users/tazjin/nixos/tverskoy/default.nix
index db330992f447..9f19210d1787 100644
--- a/users/tazjin/nixos/tverskoy/default.nix
+++ b/users/tazjin/nixos/tverskoy/default.nix
@@ -237,6 +237,7 @@ in lib.fix(self: {
       screenLock
       tools.nsfv-setup
       users.tazjin.emacs
+      third_party.dfmt
     ]) ++
 
     # programs from nixpkgs
@@ -245,7 +246,6 @@ in lib.fix(self: {
       chromium
       curl
       ddcutil
-      dfmt
       direnv
       dmd
       dnsutils