about summary refs log tree commit diff
path: root/third_party/dfmt/default.nix
blob: 5ce0d7541c253ff681b504dd40bdf07ff5f5e084 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# 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}'")
  ];

  DFLAGS = "-release";

  installPhase = ''
    mkdir -p $out/bin
    cp bin/dfmt $out/bin/
    strip -s $out/bin/dfmt
  '';

  meta = {
    description = "D code formatter";
    homepage = "https://github.com/dlang-community/dfmt";
    license = lib.licenses.boost;
  };
}