Skip to content

Commit

Permalink
refactor(dub): Use getDCInfo to remove code duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
PetarKirov committed Jun 20, 2024
1 parent c7df54c commit 534b79a
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions pkgs/dub/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,11 @@
assert dcompiler != null;
let
inherit (import ../../lib/build-status.nix { inherit lib; }) getBuildStatus;
inherit (import ../../lib/dc.nix { inherit lib; }) getDCInfo;

buildStatus = getBuildStatus "dub" version stdenv.system;

xdmdName =
if lib.hasPrefix "ldc" dcompiler.pname then
"ldmd2"
else if lib.hasPrefix "dmd" dcompiler.pname then
"dmd"
else
(
assert lib.hasPrefix "gdc" dcompiler.pname;
"gdmd"
);
hostDCInfo = getDCInfo dcompiler;
in
stdenv.mkDerivation rec {
pname = "dub";
Expand Down Expand Up @@ -81,7 +74,7 @@ stdenv.mkDerivation rec {
checkPhase = ''
export DUB=$NIX_BUILD_TOP/source/bin/dub
export PATH=$PATH:$NIX_BUILD_TOP/source/bin/
export DC=${dcompiler.out}/bin/${xdmdName}
export DC=${hostDCInfo.dmdWrapper}
echo "DC out --> $DC"
export HOME=$TMP
Expand Down

0 comments on commit 534b79a

Please sign in to comment.