Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(dub): Use getDCInfo to remove code duplication #84

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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