dub with nix (issue introduced by dub >= dub-v1.31.0)

Ralph Amissah ralph.amissah at gmail.com
Fri May 26 14:55:31 UTC 2023


My offline D project with locally downloaded subpackage directory
trees has built flawlessly with nix tools for previous versions of dub
from dub-v1.23.0 through dub-v1.30.0 which is the version currently in
nixpkgs.

However, a change to dub introduced in 1.31.0 results in my project
failing to build using dub with nix tools.  The build attempt results
in the nix not finding build directory paths as before (the build
directory within nixpkgs has been affected as now it attempts to build
in a write protected area (it ends up in what nix calls a "homeless
shelter"!)

I am hoping that it might be easy to guess what the change that would
have such an effect is likely to be... and that it can be fixed or
reverted.
https://github.com/dlang/dub/releases/tag/v1.31.0

To give an idea of my current dub build dependencies etc. I include a
copy of my dub.json (below)

Incidentally, within nix I have flakes with nixpkgs overlays which
make it easy to play with various version changes, and modify the
build process for nixpkgs for various things D (ldc2 dub dtools and
the like).
Dub builds fine and passes most if not all of its tests in nix (in the
current nixpkgs build several of  the dub tests remain removed for
having failed in the past).
I would be happy to share these, as they may reduce the hurdle for
anyone using D who is interested in experimenting with nix.

{
  "authors": [
                               "Ralph Amissah"
  ],
  "copyright":                 "2015 - 2023 Ralph Amissah",
  "name":                      "spine",
  "version":                   "0.12.0",
  "description":               "an object-centric sisu-like document parser",
  "homepage":                  "https://sisudoc.org",
  "license":                   "AGPL-3.0+",
  "targetPath":                "./bin",
  "sourcePaths":               [ "./src/doc_reform" ],
  "stringImportPaths":         [ "./views" ],
  "buildRequirements":         [ "allowWarnings" ],
  "targetType":                "executable",
  "buildTypes": {
    "dmd": {
      "dflags":                [ "-J=./views", "-I=./src/doc_reform" ],
      "buildOptions":          [ "inline", "verbose"  ],
      "buildRequirements":     [ "allowWarnings" ]
    },
    "ldc2": {
      "dflags":                [ "-O2", "-J=./views", "-I=./src/doc_reform" ],
      "buildOptions":          [ "optimize", "verbose" ],
      "buildRequirements":     [ "allowWarnings" ]
    },
    "ldmd2": {
      "dflags":                [ "-O2", "-boundscheck=on",
"-J=./views", "-I=./src/doc_reform" ],
      "buildOptions":          [ "optimize", "verbose"  ],
      "buildRequirements":     [ "allowWarnings" ]
    }
  },
  "dependencies": {
    "spine:d2sqlite3":         "*",
    "spine:imageformats":      "*",
    "spine:dyaml":             "*"
  },
  "subPackages": [
    {
      "name":        "d2sqlite3",
      "description": "A thin wrapper around SQLite 3",
      "homepage":    "https://github.com/dlang-community/d2sqlite3",
      "authors":     [ "Nicolas Sicard", "Other contributors: see
Github repo" ],
      "copyright":   "Copyright 2011-18 Nicolas Sicard",
      "license":     "BSL-1.0",
      "sourcePaths": [ "./src/ext_depends/d2sqlite3/source" ],
      "importPaths": [ "./src/ext_depends/d2sqlite3/source" ],
      "configurations": [
        {
          "name":                "d2sqlite3",
          "targetType":          "library",
          "systemDependencies":  "SQLite version >= 3.8.7",
          "libs":                [ "sqlite3" ],
          "excludedSourceFiles": [ "source/tests.d" ]
        }
      ]
    },
    {
      "name":        "imageformats",
      "description": "Decoders for PNG, TGA, BMP, JPEG and encoders
for PNG, TGA, BMP.",
      "authors":     [ "Tero Hänninen" ],
      "license":     "BSL-1.0",
      "sourcePaths": [ "./src/ext_depends/imageformats" ],
      "importPaths": [ "./src/ext_depends/imageformats" ]
    },
    {
      "name":        "dyaml",
      "description": "YAML parser and emitter",
      "authors": [
        "Ferdinand Majerech",
        "Cameron \"Herringway\" Ross"
      ],
      "license":     "BSL-1.0",
      "homepage":    "https://github.com/dlang-community/D-YAML",
      "copyright":   "Copyright © 2011-2018, Ferdinand Majerech",
      "sourcePaths": [
        "./src/ext_depends/D-YAML/source",
        "./src/ext_depends/tinyendian/source"
      ],
      "importPaths": [
        "./src/ext_depends/D-YAML/source",
        "./src/ext_depends/tinyendian/source"
      ],
      "preGenerateCommands": [
        "rm -rf ./src/ext_depends/D-YAML/examples",
        "rm -rf ./src/ext_depends/D-YAML/testsuite"
      ]
    }
  ],
  "configurations": [
    {
      "name":                  "default",
      "targetName":            "spine"
    },
    {
      "name":                  "ldc2",
      "targetName":            "spine-ldc"
    },
    {
      "name":                  "ldmd2",
      "targetName":            "spine-ldc"
    },
    {
      "name":                  "dmd",
      "targetName":            "spine-dmd"
    }
  ]
}



More information about the Digitalmars-d mailing list