nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildDubPackage,
4 fetchFromGitHub,
5 versionCheckHook,
6}:
7
8buildDubPackage rec {
9 pname = "dfmt";
10 version = "0.15.2";
11
12 src = fetchFromGitHub {
13 owner = "dlang-community";
14 repo = "dfmt";
15 tag = "v${version}";
16 hash = "sha256-QjmYPIQFs+91jB1sdaFoenfWt5TLXyEJauSSHP2fd+M=";
17 };
18
19 preBuild = ''
20 mkdir -p bin/
21 echo "v${version}" > bin/dubhash.txt
22 '';
23
24 patches = [
25 # do not run the dubhash tool, we supply the version in preBuild
26 ./fix_version.patch
27 ];
28
29 dubLock = ./dub-lock.json;
30
31 doCheck = true;
32
33 installPhase = ''
34 runHook preInstall
35 install -Dm755 bin/dfmt -t $out/bin
36 runHook postInstall
37 '';
38
39 nativeInstallCheckInputs = [
40 versionCheckHook
41 ];
42
43 doInstallCheck = true;
44
45 meta = {
46 description = "Formatter for D source code";
47 changelog = "https://github.com/dlang-community/dfmt/releases/tag/v${version}";
48 homepage = "https://github.com/dlang-community/dfmt";
49 maintainers = with lib.maintainers; [ ipsavitsky ];
50 mainProgram = "dfmt";
51 license = lib.licenses.boost;
52 };
53}