diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2024-12-05 21:48:26 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2024-12-05 21:48:26 -0500 |
commit | e95b82e1f41d45b7ddc0fcb600bb501c5846a44a (patch) | |
tree | d5728747c43a945b4e8ec54685d6df7e034c027f /org/nixpkgs_overlays_d_related.org | |
parent | nix build housekeeping, ldc, follow nixpkgs build (diff) |
nix build, dub, take account of nixpkgs build changes
Diffstat (limited to 'org/nixpkgs_overlays_d_related.org')
-rw-r--r-- | org/nixpkgs_overlays_d_related.org | 109 |
1 files changed, 69 insertions, 40 deletions
diff --git a/org/nixpkgs_overlays_d_related.org b/org/nixpkgs_overlays_d_related.org index 81c0b68..6f76fdc 100644 --- a/org/nixpkgs_overlays_d_related.org +++ b/org/nixpkgs_overlays_d_related.org @@ -380,14 +380,14 @@ direnv fetchurl https://raw.githubusercontent.com/nix-community/nix-direnv/${Nix in { packages = forAllSystems (system: let pkgs-ovl = pkgsForSystem system; - pkgs = nixpkgsFor.${system}; + pkgs-nix = nixpkgsFor.${system}; in with pkgs-ovl; { default = dub; }); devShells = forAllSystems (system: let pkgs-ovl = pkgsForSystem system; - pkgs = nixpkgsFor.${system}; + pkgs-nix = nixpkgsFor.${system}; shellHook = '' ''; in @@ -454,16 +454,25 @@ direnv fetchurl https://raw.githubusercontent.com/nix-community/nix-direnv/${Nix name = "nixpkgs - ldc - dub"; inherit shell; inherit devEnv; - #nativeBuildInputs = [ dub dmd ldc gdc gnumake ]; - #buildInputs = [ sqlite ]; - packages = with pkgs; [ + packages = with pkgs-nix; [ ldc dub gnumake ]; inherit shellHook; }; - default = import ./shell.nix {inherit pkgs;}; + dsh-nixpkgs-dmd-dub = mkShell { + name = "nixpkgs - ldc - dub"; + inherit shell; + inherit devEnv; + packages = with pkgs-nix; [ + dmd + dub + gnumake + ]; + inherit shellHook; + }; + default = import ./shell.nix {inherit pkgs-nix;}; }); }; } @@ -475,8 +484,8 @@ direnv fetchurl https://raw.githubusercontent.com/nix-community/nix-direnv/${Nix #+HEADER: :tangle-mode (identity #o755) #+HEADER: :shebang "#!/usr/bin/env -S nix-shell -I nixpkgs=/srv/nix/nixpkgs --pure\n#!nix-shell -i bash" #+BEGIN_SRC nix -{pkgs ? import <nixpkgs> {}}: -with pkgs; +{pkgs-nix ? import <nixpkgs> {}}: +with pkgs-nix; mkShell { buildInputs = [ # ❯❯❯ nix_related @@ -489,7 +498,7 @@ with pkgs; #nix-tree #nvd jq #gx - #alejandra + #nixfmt-rfc-style git # ❯❯❯ dev ldc @@ -843,17 +852,17 @@ sha256 = "<<ldc_hash>>"; **** 1.40 OK ✓ ***** 1.40.0 OK ✓ - - nix-prefetch-url --unpack https://github.com/ldc-developers/ldc/archive/refs/tags/v1.40.0-beta4.tar.gz + - nix-prefetch-url --unpack https://github.com/ldc-developers/ldc/archive/refs/tags/v1.40.0-beta5.tar.gz - nix-prefetch-url --unpack https://github.com/ldc-developers/ldc/releases/download/v${version}/ldc-${version}-src.tar.gz #+NAME: ldc_version_1_40_0 #+BEGIN_SRC nix -1.40.0-beta4 +1.40.0-beta5 #+END_SRC #+NAME: ldc_hash_1_40_0 #+BEGIN_SRC nix -sha256-AzUlWfbG/e/l9kQY3rHq+BkZAW1sRrUAAeB8yIoWZ6Q= +sha256-AaH5xw4hA0LHVx9SU3E+CIZKUHyjJ4TiPaoJnmQZJx4= #+END_SRC #+NAME: ldc_llvm_set_1_40_0 @@ -1475,11 +1484,24 @@ sha256-kTHRaAKG7cAGb4IE/NGHWaZ8t7ZceKj03l6E8wLzJzs= #+HEADER: :tangle "../nix-overlays/dub/default.nix" #+BEGIN_SRC nix -{ lib, stdenv, fetchFromGitHub, curl, libevent, rsync, ldc, dcompiler ? ldc }: +import ./package.nix +#+END_SRC + +#+HEADER: :tangle "../nix-overlays/dub/package.nix" +#+BEGIN_SRC nix +{ lib +, stdenv +, fetchFromGitHub +, curl +, <<dcompiler>> +, dcompiler ? <<dcompiler>> +, libevent +, rsync +}: assert dcompiler != null; -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "dub"; version = "<<dub_version>>"; @@ -1488,30 +1510,21 @@ stdenv.mkDerivation rec { src = fetchFromGitHub { owner = "dlang"; repo = "dub"; - rev = "v${version}"; - sha256 = "<<dub_hash>>"; + rev = "v${finalAttrs.version}"; + hash = "<<dub_hash>>"; }; - #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 "") + 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 @@ -1519,17 +1532,21 @@ stdenv.mkDerivation rec { 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 + echo "$DCn found and used as D compiler in buildPhase for $pname" ''; - doCheck = !stdenv.isDarwin; + 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/ - #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 @@ -1537,8 +1554,7 @@ stdenv.mkDerivation rec { export HOME=$TMP rm -rf test/issue502-root-import - rm -rf test/dpath-variable - #rm test/dpath-variable.sh + 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 @@ -1546,22 +1562,35 @@ stdenv.mkDerivation rec { rm -rf test/pr2647-build-deep # added to build v1.36.0 ./test/run-unittest.sh + runHook postCheck ''; installPhase = '' - mkdir -p $out/bin - cp bin/dub $out/bin + runHook preInstall + install -Dm755 bin/dub $out/bin/dub + runHook postInstall ''; meta = with lib; { - description = "Package and build manager for D applications and libraries"; + 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" ]; }; -} +}) +#+END_SRC + +*** dcompiler SET + +#+NAME: dcompiler +#+BEGIN_SRC nix +ldc +#+END_SRC + +#+BEGIN_SRC nix +dmd #+END_SRC *** versions SET |