diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2024-12-05 21:53:24 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2024-12-05 21:53:24 -0500 |
commit | ad607f7760ddd3c2bb7d29740feb115a28514948 (patch) | |
tree | 90f3ea89bac3e3052781a8416fc24e87683e24fd /nix-overlays | |
parent | nix build housekeeping, ldc, follow nixpkgs build (diff) |
nix build, dub, take account of nixpkgs build changes
Diffstat (limited to 'nix-overlays')
-rw-r--r-- | nix-overlays/dub/default.nix | 88 | ||||
-rw-r--r-- | nix-overlays/dub/package.nix | 91 |
2 files changed, 92 insertions, 87 deletions
diff --git a/nix-overlays/dub/default.nix b/nix-overlays/dub/default.nix index b2a2283..8375c13 100644 --- a/nix-overlays/dub/default.nix +++ b/nix-overlays/dub/default.nix @@ -1,87 +1 @@ -{ lib, stdenv, fetchFromGitHub, curl, libevent, rsync, ldc, dcompiler ? ldc }: - -assert dcompiler != null; - -stdenv.mkDerivation rec { - pname = "dub"; - version = "1.38.1"; - - enableParallelBuilding = true; - - src = fetchFromGitHub { - owner = "dlang"; - repo = "dub"; - rev = "v${version}"; - sha256 = "sha256-8Lr/0sx4SKwU1aNOxZArta0RXpDM+EWl29ZsPDdPWFo="; - }; - - #postUnpack = '' - # patchShebangs . - #''; - - dubvar = "\\$DUB"; - postPatch = '' - patchShebangs test - - # Can be removed with https://github.com/dlang/dub/pull/1368 - substituteInPlace test/fetchzip.sh \ - --replace "dub remove" "\"${dubvar}\" remove" - ''; - - nativeBuildInputs = [ dcompiler libevent rsync ]; - buildInputs = [ curl ]; - - buildPhase = '' - for DC_ in dmd ldmd2 gdmd; do - echo "... check for D compiler $DC_ ..." - export DC=$(type -P $DC_ || echo "") - if [ ! "$DC" == "" ]; then - break - fi - done - if [ "$DC" == "" ]; then - exit "Error: could not find D compiler" - fi - echo "$DC_ found and used as D compiler in buildPhase for $pname" - $DC ./build.d - ./build - ''; - - doCheck = !stdenv.isDarwin; - - checkPhase = '' - export DUB=$NIX_BUILD_TOP/source/bin/dub - export PATH=$PATH:$NIX_BUILD_TOP/source/bin/ - #export DC=${dcompiler.out}/bin/${if dcompiler.pname=="ldc" then "ldc2" else dcompiler.pname} - if [ "$DC" == "" ]; then - exit "Error: could not find D compiler" - fi - echo "DC out --> $DC" - export HOME=$TMP - - rm -rf test/issue502-root-import - rm -rf test/dpath-variable - #rm test/dpath-variable.sh - rm -rf test/git-dependency - rm -rf test/use-c-sources # added to build v1.33.0 - rm -rf test/pr2642-cache-db # added to build v1.34.0 - rm -rf test/pr2644-describe-artifact-path # added to build v1.36.0 - rm -rf test/pr2647-build-deep # added to build v1.36.0 - - ./test/run-unittest.sh - ''; - - installPhase = '' - mkdir -p $out/bin - cp bin/dub $out/bin - ''; - - meta = with lib; { - description = "Package and build manager for D applications and libraries"; - homepage = "https://code.dlang.org/"; - license = licenses.mit; - mainProgram = "dub"; - maintainers = with maintainers; [ jtbx ]; - platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; - }; -} +import ./package.nix diff --git a/nix-overlays/dub/package.nix b/nix-overlays/dub/package.nix new file mode 100644 index 0000000..f13adec --- /dev/null +++ b/nix-overlays/dub/package.nix @@ -0,0 +1,91 @@ +{ lib +, stdenv +, fetchFromGitHub +, curl +, ldc +, dcompiler ? ldc +, libevent +, rsync +}: + +assert dcompiler != null; + +stdenv.mkDerivation (finalAttrs: { + pname = "dub"; + version = "1.38.1"; + + enableParallelBuilding = true; + + src = fetchFromGitHub { + owner = "dlang"; + repo = "dub"; + rev = "v${finalAttrs.version}"; + hash = "sha256-8Lr/0sx4SKwU1aNOxZArta0RXpDM+EWl29ZsPDdPWFo="; + }; + + postPatch = '' + patchShebangs test + ''; + + nativeBuildInputs = [ dcompiler libevent rsync ]; + buildInputs = [ curl ]; + + preBuild = '' + for DCn in dmd ldmd2 gdmd; do + echo "... check for D compiler $DCn ..." + export DC=$(type -P $DCn || echo "") + if [ ! "$DC" == "" ]; then + break + fi + done + if [ "$DC" == "" ]; then + exit "Error: could not find D compiler" + fi + echo "$DCn found and used as D compiler in buildPhase for $pname" + ''; + + buildPhase = '' + runHook preBuild + $DC -run ./build.d + runHook postBuild + ''; + + doCheck = !stdenv.hostPlatform.isDarwin; + + checkPhase = '' + runHook preCheck + export DUB=$NIX_BUILD_TOP/source/bin/dub + export PATH=$PATH:$NIX_BUILD_TOP/source/bin/ + if [ "$DC" == "" ]; then + exit "Error: could not find D compiler" + fi + echo "DC out --> $DC" + export HOME=$TMP + + rm -rf test/issue502-root-import + rm -r test/dpath-variable # requires execution of dpath-variable.sh + rm -rf test/git-dependency + rm -rf test/use-c-sources # added to build v1.33.0 + rm -rf test/pr2642-cache-db # added to build v1.34.0 + rm -rf test/pr2644-describe-artifact-path # added to build v1.36.0 + rm -rf test/pr2647-build-deep # added to build v1.36.0 + + ./test/run-unittest.sh + runHook postCheck + ''; + + installPhase = '' + runHook preInstall + install -Dm755 bin/dub $out/bin/dub + runHook postInstall + ''; + + meta = with lib; { + description = "Package and build manager for D programs and libraries"; + homepage = "https://code.dlang.org/"; + license = licenses.mit; + mainProgram = "dub"; + maintainers = with maintainers; [ jtbx ]; + platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + }; +}) |