-*- mode: org -*-
#+TITLE:       D related overlays
#+DESCRIPTION: ldc, dub, dtools: dlang compiler build tool and tools
#+FILETAGS:    :dlang:build:tools:
#+AUTHOR:      Ralph Amissah
#+EMAIL:       [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]]
#+COPYRIGHT:   Copyright (C) 2015 - 2023 Ralph Amissah
#+LANGUAGE:    en
#+STARTUP:     content hideblocks hidestars noindent entitiespretty

* README for D related overlays
** dlang-nix-overlays

Nix build overlays for building and testing more recent versions of the dlang
compiler and build tools: ldc, dub and dtools, than exist in nixpkgs at the time
of publishing, in some cases with additional fixes.

nix overlays for (updates nixpkgs, more recent versions of):
  - ldc     ( 1.30.0 -> 1.35.0 )
  - dub     ( 1.23.0 -> 1.34.0 ) [for nix versions 1.31.0 ... 1.33.0 broken]
  - dtools  ( 2.095.1 -> 2.103.1 )

  - dmd     ( 2.100.2 -> 2.104.0 ) KO ✗
  - gdc     [not yet available]

(updates nixpkgs circa 2023-05-12)

dlang-nix-flakes.org --❯
  .
  └── nix-overlays
      ├── dmd
      │   ├── binary.nix
      │   ├── bootstrap.nix
      │   ├── default.nix
      │   └── generic.nix
      ├── dtools
      │   └── default.nix
      ├── dub
      │   └── default.nix
      ├── ldc
      │   ├── binary.nix
      │   ├── bootstrap.nix
      │   ├── default.nix
      │   └── generic.nix
      └── README

search nixpkgs here:

- https://search.nixos.org/packages?channel=unstable&from=0&size=100&sort=relevance&query=

** compilers
*** ldc OK ✓ ( 1.30.0 -> 1.35.0 )

- https://wiki.dlang.org/LDC

- https://github.com/ldc-developers/ldc
  - https://github.com/ldc-developers/ldc/releases
    nix-prefetch-url --unpack https://github.com/ldc-developers/ldc/archive/refs/tags/v1.35.0.tar.gz
  - https://github.com/ldc-developers/ldc/issues

- 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 )

- 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.104.0.tar.gz
  - https://github.com/dlang/dmd/pulls

- version in nixpkgs:
  - https://search.nixos.org/packages?channel=unstable&show=dmd&from=0&size=100&sort=relevance&type=packages&query=dmd

- dmd nixpkg modified and appears to build ok, but it appears my overlay does
  not get things right REVIEW

- dmd on nixos FAILS to build (my working projects), appears not to find parts
  of itself

*** gdc ( not provided yet with gcc12 in nixpkgs )

not yet provided in nixpkgs with gcc12, no attempt made

- https://wiki.dlang.org/GDC
  - https://wiki.dlang.org/GDC_Development

- https://github.com/D-Programming-GDC/gdc

** build tool
*** dub ( 1.23.0 -> 1.34.0 )

- https://code.dlang.org/packages/dub

- https://github.com/dlang/dub
  - https://github.com/dlang/dub/releases
    nix-prefetch-url --unpack https://github.com/dlang/dub/archive/refs/tags/v1.34.0.tar.gz
  - https://github.com/dlang/dub/issues

- version in nixpkgs:
  - https://search.nixos.org/packages?channel=unstable&show=dub&from=0&size=100&sort=relevance&type=packages&query=dub

- dub nixpkg overlay is updated and runs most dub tests correctly

- dub OK ✓ ( 1.30.0 -> 1.34.0 )

  from v1.31.0 requires seeting of pwd in buildPhase else fails to build
  packages with nix tools that previous version of dub built;

** tools
*** dtools OK ✓ ( 2.095.1 -> 2.103.1 )

- https://code.dlang.org/packages/dtools

- https://github.com/dlang/tools
  - https://github.com/dlang/tools/tags
    nix-prefetch --unpack https://github.com/dlang/tools/archive/refs/tags/v2.103.1.tar.gz
  - https://github.com/dlang/tools/issues

- version in nixpkgs
  - https://search.nixos.org/packages?channel=unstable&show=dtools&from=0&size=100&sort=relevance&type=packages&query=dtools

** nixpkgs

It is possible to work directly against a local copy of nixpkgs. To do so you
would clone nixpkgs and point to the local nixpkgs as your build source.

git clone --depth=1 --branch master https://github.com/nixos/nixpkgs nixpkgs

- ./nixpkgs/pkgs/development/compilers/ldc
- ./nixpkgs/pkgs/development/compilers/dmd
- ./nixpkgs/pkgs/development/tools/build-managers/dub
- ./nixpkgs/pkgs/development/tools/dtools

- ./nixpkgs/pkgs/development/compilers/gcc

Note the overlays if copied to the nixpkgs path locations should work as they do
in the overlay, with a pointer to the cloned nixpkgs as nixpkgs repository
source. In fact the starting point for the overlays was to take verbatim what
was in nixpkgs and then to update and fix where necessary those packages.

It is possible to compare the changes made by the overlays here directly against
what is currently available in nixpkgs.

- https://search.nixos.org/packages?channel=unstable&size=100&sort=relevance&query=

nix flake update && nix flake check --show-trace && nix flake info && echo "" && nix flake show