From 12e35232f5cb60404b292bb67b5e735e72474bbf Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 9 May 2024 08:53:06 -0400 Subject: nix dlang overlay dmd-2.108.0, follow upstream - less passing Foundation - default.nix filename kept (upstream using package.nix) --- nix-overlays/README | 6 +- nix-overlays/dmd/default.nix | 6 +- nix-overlays/dmd/generic.nix | 69 ++++++++-------- org/nixpkgs_overlays_d_related.org | 159 +++++++++++++++++++++++-------------- 4 files changed, 136 insertions(+), 104 deletions(-) diff --git a/nix-overlays/README b/nix-overlays/README index 421074f..01ad9e7 100644 --- a/nix-overlays/README +++ b/nix-overlays/README @@ -20,7 +20,7 @@ nix overlays for (updates nixpkgs, more recent versions of): - dub ( 1.23.0 -> 1.36.0 ) [for nix versions 1.31.0 ... 1.33.0 broken] - dtools ( 2.095.1 -> 2.103.1 ) - - dmd ( 2.106.1 -> 2.106.1 ) + - dmd ( 2.106.1 -> 2.108.0 ) - gdc [not yet available] dlang-nix-flakes.org --❯ @@ -59,14 +59,14 @@ search nixpkgs here: - version in nixpkgs: - https://search.nixos.org/packages?channel=unstable&show=ldc&from=0&size=100&sort=relevance&type=packages&query=ldc -*** dmd KO ✗ ( 2.100.2 -> 2.104.0); OK ✓ ( 2.106.1 ) +*** dmd OK ✓ ( 2.100.2 -> 2.108.0 ) - https://dlang.org/ - https://wiki.dlang.org/LDC - https://github.com/dlang/dmd - https://github.com/dlang/dmd/tags - nix-prefetch-url --unpack https://github.com/dlang/dmd/archive/refs/tags/v2.106.1.tar.gz + nix-prefetch-url --unpack https://github.com/dlang/dmd/archive/refs/tags/v2.108.0.tar.gz - https://github.com/dlang/dmd/pulls - version in nixpkgs: diff --git a/nix-overlays/dmd/default.nix b/nix-overlays/dmd/default.nix index bdc9faf..9f3f5a2 100644 --- a/nix-overlays/dmd/default.nix +++ b/nix-overlays/dmd/default.nix @@ -1,5 +1,5 @@ import ./generic.nix { - version = "2.106.1"; - dmdSha256 = "sha256-vjYa/Pxrz7J2htXT+fa+xaeen/Vxne++lELbHTSXBK8="; - phobosSha256 = "sha256-yRL9ub3u4mREG9PVxBvgQ/LDXD57RadPTZ2h08qyh/s="; + version = "2.108.0"; + dmdHash = "sha256-tlWcFgKtXzfqMMkOq4ezhZHdYCXFckjN5+m6jO4VH0U="; + phobosHash = "sha256-uU8S4rABOfhpKh+MvSbclkbdf0hrsuKF8SIpWMnPpfU="; } diff --git a/nix-overlays/dmd/generic.nix b/nix-overlays/dmd/generic.nix index a2a1b8a..63c2bd1 100644 --- a/nix-overlays/dmd/generic.nix +++ b/nix-overlays/dmd/generic.nix @@ -1,6 +1,6 @@ { version -, dmdSha256 -, phobosSha256 +, dmdHash +, phobosHash }: { stdenv @@ -22,7 +22,7 @@ , git , unzip , dmdBootstrap ? callPackage ./bootstrap.nix { } -, dmd_bin ? "${dmdBootstrap}/bin" +, dmdBin ? "${dmdBootstrap}/bin" }: let @@ -45,7 +45,7 @@ let pathToDmd = "\${NIX_BUILD_TOP}/dmd/generated/${osname}/release/${bits}/dmd"; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "dmd"; inherit version; @@ -55,15 +55,15 @@ stdenv.mkDerivation rec { (fetchFromGitHub { owner = "dlang"; repo = "dmd"; - rev = "v${version}"; - sha256 = dmdSha256; + rev = "v${finalAttrs.version}"; + hash = dmdHash; name = "dmd"; }) (fetchFromGitHub { owner = "dlang"; repo = "phobos"; - rev = "v${version}"; - sha256 = phobosSha256; + rev = "v${finalAttrs.version}"; + hash = phobosHash; name = "phobos"; }) ]; @@ -80,7 +80,7 @@ stdenv.mkDerivation rec { url = "https://github.com/dlang/dmd/commit/c4d33e5eb46c123761ac501e8c52f33850483a8a.patch"; stripLen = 1; extraPrefix = "dmd/"; - sha256 = "sha256-N21mAPfaTo+zGCip4njejasraV5IsWVqlGR5eOdFZZE="; + hash = "sha256-N21mAPfaTo+zGCip4njejasraV5IsWVqlGR5eOdFZZE="; }) ]; @@ -102,18 +102,14 @@ stdenv.mkDerivation rec { # https://issues.dlang.org/show_bug.cgi?id=23317 rm dmd/compiler/test/runnable/cdvecfill.sh rm dmd/compiler/test/compilable/cdcmp.d - '' - - + lib.optionalString (lib.versionAtLeast version "2.089.0" && lib.versionOlder version "2.092.2") '' + '' + lib.optionalString (lib.versionAtLeast version "2.089.0" && lib.versionOlder version "2.092.2") '' rm dmd/compiler/test/dshell/test6952.d '' + lib.optionalString (lib.versionAtLeast version "2.092.2") '' - substituteInPlace dmd/compiler/test/dshell/test6952.d --replace "/usr/bin/env bash" "${bash}/bin/bash" - '' - - + lib.optionalString stdenv.isLinux '' - substituteInPlace phobos/std/socket.d --replace "assert(ih.addrList[0] == 0x7F_00_00_01);" "" + substituteInPlace dmd/compiler/test/dshell/test6952.d --replace-fail "/usr/bin/env bash" "${bash}/bin/bash" + '' + lib.optionalString stdenv.isLinux '' + substituteInPlace phobos/std/socket.d --replace-fail "assert(ih.addrList[0] == 0x7F_00_00_01);" "" '' + lib.optionalString stdenv.isDarwin '' - substituteInPlace phobos/std/socket.d --replace "foreach (name; names)" "names = []; foreach (name; names)" + substituteInPlace phobos/std/socket.d --replace-fail "foreach (name; names)" "names = []; foreach (name; names)" ''; nativeBuildInputs = [ @@ -148,24 +144,23 @@ stdenv.mkDerivation rec { runHook preBuild export buildJobs=$NIX_BUILD_CORES - if [ -z $enableParallelBuilding ]; then - buildJobs=1 - fi + [ -z "$enableParallelBuilding" ] && buildJobs=1 - ${dmd_bin}/rdmd dmd/compiler/src/build.d -j$buildJobs HOST_DMD=${dmd_bin}/dmd $buildFlags - make -C dmd/druntime -f posix.mak DMD=${pathToDmd} $buildFlags -j$buildJobs + ${dmdBin}/rdmd dmd/compiler/src/build.d -j$buildJobs $buildFlags \ + HOST_DMD=${dmdBin}/dmd + make -C dmd/druntime -j$buildJobs DMD=${pathToDmd} $buildFlags echo ${tzdata}/share/zoneinfo/ > TZDatabaseDirFile - echo ${lib.getLib curl}/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary} > LibcurlPathFile - make -C phobos -f posix.mak $buildFlags -j$buildJobs DMD=${pathToDmd} DFLAGS="-version=TZDatabaseDir -version=LibcurlPath -J$PWD" + echo ${lib.getLib curl}/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary} \ + > LibcurlPathFile + make -C phobos -j$buildJobs $buildFlags \ + DMD=${pathToDmd} DFLAGS="-version=TZDatabaseDir -version=LibcurlPath -J$PWD" runHook postBuild ''; doCheck = true; - checkFlags = buildFlags; - - # many tests are disbled because they are failing + # many tests are disabled because they are failing # NOTE: Purity check is disabled for checkPhase because it doesn't fare well # with the DMD linker. See https://github.com/NixOS/nixpkgs/issues/97420 @@ -173,15 +168,14 @@ stdenv.mkDerivation rec { runHook preCheck export checkJobs=$NIX_BUILD_CORES - if [ -z $enableParallelChecking ]; then - checkJobs=1 - fi + [ -z "$enableParallelChecking" ] && checkJobs=1 - NIX_ENFORCE_PURITY= \ - make -C dmd/compiler/test $checkFlags CC=$CXX SHELL=$SHELL -j$checkJobs N=$checkJobs + CC=$CXX HOST_DMD=${pathToDmd} NIX_ENFORCE_PURITY= \ + ${dmdBin}/rdmd dmd/compiler/test/run.d -j$checkJobs NIX_ENFORCE_PURITY= \ - make -C phobos -f posix.mak unittest $checkFlags -j$checkJobs DFLAGS="-version=TZDatabaseDir -version=LibcurlPath -J$PWD" + make -C phobos unittest -j$checkJobs $checkFlags \ + DFLAGS="-version=TZDatabaseDir -version=LibcurlPath -J$PWD" runHook postCheck ''; @@ -200,7 +194,7 @@ stdenv.mkDerivation rec { cp phobos/generated/${osname}/release/${bits}/libphobos2.* $out/lib/ wrapProgram $out/bin/dmd \ - --prefix PATH ":" "${targetPackages.stdenv.cc}/bin" \ + --prefix PATH : "${targetPackages.stdenv.cc}/bin" \ --set-default CC "${targetPackages.stdenv.cc}/bin/cc" substitute ${dmdConfFile} "$out/bin/dmd.conf" --subst-var out @@ -209,7 +203,7 @@ stdenv.mkDerivation rec { ''; preFixup = '' - find $out/bin -type f -exec ${removeReferencesTo}/bin/remove-references-to -t ${dmd_bin}/dmd '{}' + + find $out/bin -type f -exec ${removeReferencesTo}/bin/remove-references-to -t ${dmdBin}/dmd '{}' + ''; disallowedReferences = [ dmdBootstrap ]; @@ -220,7 +214,8 @@ stdenv.mkDerivation rec { # Everything is now Boost licensed, even the backend. # https://github.com/dlang/dmd/pull/6680 license = licenses.boost; + mainProgram = "dmd"; maintainers = with maintainers; [ lionello dukc jtbx ]; platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ]; }; -} +}) diff --git a/org/nixpkgs_overlays_d_related.org b/org/nixpkgs_overlays_d_related.org index dc5676f..ac1331b 100644 --- a/org/nixpkgs_overlays_d_related.org +++ b/org/nixpkgs_overlays_d_related.org @@ -82,7 +82,7 @@ search nixpkgs here: - version in nixpkgs: - https://search.nixos.org/packages?channel=unstable&show=ldc&from=0&size=100&sort=relevance&type=packages&query=ldc -,*** dmd KO ✗ ( 2.100.2 -> 2.104.0); OK ✓ ( <> ) +,*** dmd OK ✓ ( 2.100.2 -> <> ) - https://dlang.org/ - https://wiki.dlang.org/LDC @@ -238,25 +238,14 @@ if [[ ! -d ./.git ]]; then git add . fi #eval "$(nix print-dev-env)" -echo ' - .envrc-local echo ❯❯ - - ❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" -c $SHELL - - ❯❯ nix develop - ❯❯ nix develop -c $SHELL - ❯❯ nix develop ".#dsh-overlay-ldc" --print-build-logs - - ❯❯ nix build - ❯❯ nix build ".#default" --print-build-logs -' #+END_SRC *** .envrc-nix - https://github.com/nix-community/nix-direnv -- NixDirEnvSHA="sha256-0000000000000000000000000000000000000000000=" -- direnv fetchurl https://raw.githubusercontent.com/nix-community/nix-direnv/${NixDirEnvVersion}/direnvrc + - source_url + - direnv fetchurl "https://raw.githubusercontent.com/nix-community/nix-direnv/<>/direnvrc" "<>" + - ${NixDirEnvVersion} #+HEADER: :tangle-NO "../nix-overlays/.envrc-nix" #+BEGIN_SRC sh @@ -403,7 +392,7 @@ direnv fetchurl https://raw.githubusercontent.com/nix-community/nix-direnv/${Nix inherit shellHook; }; dsh-overlay-dmd-dub = mkShell { - name = "overlay - dmd-<> - dub-<> - broken"; + name = "overlay - dmd-<> - dub-<>"; inherit shell; inherit devEnv; packages = [ @@ -467,7 +456,7 @@ with pkgs; mkShell { buildInputs = [ # ❯❯❯ nix_related - nix + #nix direnv nixVersions.nix_2_21 #nixVersions.latest #nixVersions.git nix-prefetch-git @@ -476,7 +465,7 @@ with pkgs; #nix-tree #nvd jq #gx - alejandra + #alejandra git # ❯❯❯ dev ldc @@ -490,7 +479,6 @@ with pkgs; shellHook = '' #echo ' # shell.nix echo ❯❯ - # ❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" -c $SHELL #' ''; @@ -1028,9 +1016,22 @@ llvm_14 *** overlays **** default.nix +***** default.nix >=2.108.0) #+HEADER: :tangle "../nix-overlays/dmd/default.nix" #+BEGIN_SRC nix +import ./generic.nix { + version = "<>"; + dmdHash = "<>"; + phobosHash = "<>"; +} +#+END_SRC + +***** default.nix < 2.108.0) + + +#+HEADER: :tangle-NO "../nix-overlays/dmd/default.nix" +#+BEGIN_SRC nix import ./generic.nix { version = "<>"; dmdSha256 = "<>"; @@ -1043,8 +1044,8 @@ import ./generic.nix { #+HEADER: :tangle "../nix-overlays/dmd/generic.nix" #+BEGIN_SRC nix { version -, dmdSha256 -, phobosSha256 +, dmdHash +, phobosHash }: { stdenv @@ -1066,7 +1067,7 @@ import ./generic.nix { , git , unzip , dmdBootstrap ? callPackage ./bootstrap.nix { } -, dmd_bin ? "${dmdBootstrap}/bin" +, dmdBin ? "${dmdBootstrap}/bin" }: let @@ -1089,7 +1090,7 @@ let pathToDmd = "\${NIX_BUILD_TOP}/dmd/generated/${osname}/release/${bits}/dmd"; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "dmd"; inherit version; @@ -1099,15 +1100,15 @@ stdenv.mkDerivation rec { (fetchFromGitHub { owner = "dlang"; repo = "dmd"; - rev = "v${version}"; - sha256 = dmdSha256; + rev = "v${finalAttrs.version}"; + hash = dmdHash; name = "dmd"; }) (fetchFromGitHub { owner = "dlang"; repo = "phobos"; - rev = "v${version}"; - sha256 = phobosSha256; + rev = "v${finalAttrs.version}"; + hash = phobosHash; name = "phobos"; }) ]; @@ -1124,7 +1125,7 @@ stdenv.mkDerivation rec { url = "https://github.com/dlang/dmd/commit/c4d33e5eb46c123761ac501e8c52f33850483a8a.patch"; stripLen = 1; extraPrefix = "dmd/"; - sha256 = "sha256-N21mAPfaTo+zGCip4njejasraV5IsWVqlGR5eOdFZZE="; + hash = "sha256-N21mAPfaTo+zGCip4njejasraV5IsWVqlGR5eOdFZZE="; }) ]; @@ -1146,18 +1147,14 @@ stdenv.mkDerivation rec { # https://issues.dlang.org/show_bug.cgi?id=23317 rm dmd/compiler/test/runnable/cdvecfill.sh rm dmd/compiler/test/compilable/cdcmp.d - '' - - + lib.optionalString (lib.versionAtLeast version "2.089.0" && lib.versionOlder version "2.092.2") '' + '' + lib.optionalString (lib.versionAtLeast version "2.089.0" && lib.versionOlder version "2.092.2") '' rm dmd/compiler/test/dshell/test6952.d '' + lib.optionalString (lib.versionAtLeast version "2.092.2") '' - substituteInPlace dmd/compiler/test/dshell/test6952.d --replace "/usr/bin/env bash" "${bash}/bin/bash" - '' - - + lib.optionalString stdenv.isLinux '' - substituteInPlace phobos/std/socket.d --replace "assert(ih.addrList[0] == 0x7F_00_00_01);" "" + substituteInPlace dmd/compiler/test/dshell/test6952.d --replace-fail "/usr/bin/env bash" "${bash}/bin/bash" + '' + lib.optionalString stdenv.isLinux '' + substituteInPlace phobos/std/socket.d --replace-fail "assert(ih.addrList[0] == 0x7F_00_00_01);" "" '' + lib.optionalString stdenv.isDarwin '' - substituteInPlace phobos/std/socket.d --replace "foreach (name; names)" "names = []; foreach (name; names)" + substituteInPlace phobos/std/socket.d --replace-fail "foreach (name; names)" "names = []; foreach (name; names)" ''; nativeBuildInputs = [ @@ -1192,24 +1189,23 @@ stdenv.mkDerivation rec { runHook preBuild export buildJobs=$NIX_BUILD_CORES - if [ -z $enableParallelBuilding ]; then - buildJobs=1 - fi + [ -z "$enableParallelBuilding" ] && buildJobs=1 - ${dmd_bin}/rdmd dmd/compiler/src/build.d -j$buildJobs HOST_DMD=${dmd_bin}/dmd $buildFlags - make -C dmd/druntime -f posix.mak DMD=${pathToDmd} $buildFlags -j$buildJobs + ${dmdBin}/rdmd dmd/compiler/src/build.d -j$buildJobs $buildFlags \ + HOST_DMD=${dmdBin}/dmd + make -C dmd/druntime -j$buildJobs DMD=${pathToDmd} $buildFlags echo ${tzdata}/share/zoneinfo/ > TZDatabaseDirFile - echo ${lib.getLib curl}/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary} > LibcurlPathFile - make -C phobos -f posix.mak $buildFlags -j$buildJobs DMD=${pathToDmd} DFLAGS="-version=TZDatabaseDir -version=LibcurlPath -J$PWD" + echo ${lib.getLib curl}/lib/libcurl${stdenv.hostPlatform.extensions.sharedLibrary} \ + > LibcurlPathFile + make -C phobos -j$buildJobs $buildFlags \ + DMD=${pathToDmd} DFLAGS="-version=TZDatabaseDir -version=LibcurlPath -J$PWD" runHook postBuild ''; doCheck = true; - checkFlags = buildFlags; - - # many tests are disbled because they are failing + # many tests are disabled because they are failing # NOTE: Purity check is disabled for checkPhase because it doesn't fare well # with the DMD linker. See https://github.com/NixOS/nixpkgs/issues/97420 @@ -1217,15 +1213,14 @@ stdenv.mkDerivation rec { runHook preCheck export checkJobs=$NIX_BUILD_CORES - if [ -z $enableParallelChecking ]; then - checkJobs=1 - fi + [ -z "$enableParallelChecking" ] && checkJobs=1 - NIX_ENFORCE_PURITY= \ - make -C dmd/compiler/test $checkFlags CC=$CXX SHELL=$SHELL -j$checkJobs N=$checkJobs + CC=$CXX HOST_DMD=${pathToDmd} NIX_ENFORCE_PURITY= \ + ${dmdBin}/rdmd dmd/compiler/test/run.d -j$checkJobs NIX_ENFORCE_PURITY= \ - make -C phobos -f posix.mak unittest $checkFlags -j$checkJobs DFLAGS="-version=TZDatabaseDir -version=LibcurlPath -J$PWD" + make -C phobos unittest -j$checkJobs $checkFlags \ + DFLAGS="-version=TZDatabaseDir -version=LibcurlPath -J$PWD" runHook postCheck ''; @@ -1244,7 +1239,7 @@ stdenv.mkDerivation rec { cp phobos/generated/${osname}/release/${bits}/libphobos2.* $out/lib/ wrapProgram $out/bin/dmd \ - --prefix PATH ":" "${targetPackages.stdenv.cc}/bin" \ + --prefix PATH : "${targetPackages.stdenv.cc}/bin" \ --set-default CC "${targetPackages.stdenv.cc}/bin/cc" substitute ${dmdConfFile} "$out/bin/dmd.conf" --subst-var out @@ -1253,7 +1248,7 @@ stdenv.mkDerivation rec { ''; preFixup = '' - find $out/bin -type f -exec ${removeReferencesTo}/bin/remove-references-to -t ${dmd_bin}/dmd '{}' + + find $out/bin -type f -exec ${removeReferencesTo}/bin/remove-references-to -t ${dmdBin}/dmd '{}' + ''; disallowedReferences = [ dmdBootstrap ]; @@ -1264,10 +1259,11 @@ stdenv.mkDerivation rec { # Everything is now Boost licensed, even the backend. # https://github.com/dlang/dmd/pull/6680 license = licenses.boost; + mainProgram = "dmd"; maintainers = with maintainers; [ lionello dukc jtbx ]; platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ]; }; -} +}) #+END_SRC **** bootstrap.nix @@ -1373,17 +1369,56 @@ stdenv.mkDerivation { #+NAME: dmd_version #+BEGIN_SRC nix -<> +<> #+END_SRC #+NAME: dmd_hash #+BEGIN_SRC nix -<> +<> #+END_SRC #+NAME: phobos_hash #+BEGIN_SRC nix -<> +<> +#+END_SRC + +**** 2.108.0 OK ✓ + +- nix-prefetch-url --unpack https://github.com/dlang/dmd/archive/refs/tags/v2.108.0.tar.gz +- nix-prefetch-url --unpack https://github.com/dlang/phobos/archive/refs/tags/v2.108.0.tar.gz + +#+NAME: dmd_version_2_108_0 +#+BEGIN_SRC nix +2.108.0 +#+END_SRC + +#+NAME: dmd_hash_2_108_0 +#+BEGIN_SRC nix +sha256-tlWcFgKtXzfqMMkOq4ezhZHdYCXFckjN5+m6jO4VH0U= +#+END_SRC + +#+NAME: phobos_hash_2_108_0 +#+BEGIN_SRC nix +sha256-uU8S4rABOfhpKh+MvSbclkbdf0hrsuKF8SIpWMnPpfU= +#+END_SRC + +**** 2.107.0 - skip (asleep here apparently) + +- asleep apparently + +#+NAME: dmd_version_2_107_0 +#+BEGIN_SRC nix +2.107.0 +#+END_SRC + +#+NAME: dmd_hash_2_107_0 +#+BEGIN_SRC nix +<> +#+END_SRC + +#+NAME: phobos_hash_2_107_0 +#+BEGIN_SRC nix +<> #+END_SRC **** 2.106.1 OK ✓ @@ -1487,15 +1522,17 @@ sha256-kTHRaAKG7cAGb4IE/NGHWaZ8t7ZceKj03l6E8wLzJzs= **** notes -- OK dub == 1.30.0 OK ✓ +- OK dub == current OK ✓ -- NOTES for dub >= 1.31.0 KO ✗ +- NOTES for dub 1.33.0 >= 1.31.0 KO ✗ - dub builds test tilix which calls in gtkd - ISSUES dub FAILS to build project from local disk that has built without issue since dub v1.23.0 - BROKEN breaks on subproject ends up in nix: Error /homeless-shelter: Permission denied +- OK dub == 1.30.0 OK ✓ + *** overlays **** default.nix OK ✓ -- cgit v1.2.3