Skip to content

Conversation

@andreabedini
Copy link
Member

@andreabedini andreabedini commented Jan 15, 2026

This pull request updates the nix-tools build and planning infrastructure, focusing on enhancements to the install plan JSON output, code cleanup, and development environment improvements. The most significant changes are the addition of detailed build command arguments to the JSON plan output, refactoring for clarity and correctness, and updates to the development shell configuration.

Enhancements to install plan JSON output:

  • Added fields for configure-args, build-args, copy-args, haddock-args, test-args, benchmark-args, and repl-args in the JSON output, providing explicit command-line arguments used for each build step. This helps with debugging and reproducibility.
  • Introduced the renderFlags helper function to standardize how command-line arguments are rendered for various Cabal commands in the JSON output.

Code refactoring and correctness improvements:

  • Fixed typos in function names (e.g., avaialbeTargetToJavailableTargetToJ) and improved mapping logic for dependencies to ensure correct JSON encoding. [1] [2] [3]
  • Cleaned up and reordered imports in ProjectPlanOutput.hs for clarity and maintainability, and suppressed certain warnings and linting suggestions. [1] [2]

Development and build environment updates:

  • Updated the cabal.project to specify ghc-9.6 as the compiler, ensuring consistent builds across environments.
  • Modified the dev shell tools configuration in overlay.nix to use default tool selections for cabal and add haskell-language-server for improved Haskell development experience.

Example output:

{
  "type": "configured",
  "id": "Cabal-3.14.2.0-a95e1e8a8bc5e7fd4098d00c84207458f701bc6be999ca7f9f17247713014b27",
  "pkg-name": "Cabal",
  "pkg-version": "3.14.2.0",
  "flags": {},
  "style": "global",
  "pkg-src": {
    "type": "repo-tar",
    "repo": {
      "type": "secure-repo",
      "uri": "http://hackage.haskell.org/"
    }
  },
  "pkg-cabal-sha256": "f98aa86a37b9920dc6dfc8d79119a10df69542734f158a1c66ff144592f1d004",
  "pkg-src-sha256": "a58ca2b17c250472ed4dac0ec0aa2c65173701cbfdfecca104713f73b4429432",
  "depends": [
    "Cabal-syntax-3.14.2.0-be475844da27bcbf1c35aec7937d0c63838b3ad1bd46f667d32703da3106665e",
    "array-0.5.8.0",
    "base-4.18.3.0",
    "bytestring-0.11.5.4",
    "containers-0.6.7",
    "deepseq-1.4.8.1",
    "directory-1.3.8.5",
    "filepath-1.4.301.0",
    "mtl-2.3.1",
    "parsec-3.1.16.1",
    "pretty-1.1.3.6",
    "process-1.6.19.0",
    "time-1.12.2",
    "transformers-0.6.1.0",
    "unix-2.8.6.0"
  ],
  "exe-depends": [],
  "component-name": "lib",
  "configure-args": [
    "configure",
    "--ghc",
    "--prefix=/home/andrea/.local/state/cabal/store/ghc-9.6.7/Cabal-3.14.2.0-a95e1e8a8bc5e7fd4098d00c84207458f701bc6be999ca7f9f17247713014b27",
    "--bindir=/home/andrea/.local/state/cabal/store/ghc-9.6.7/Cabal-3.14.2.0-a95e1e8a8bc5e7fd4098d00c84207458f701bc6be999ca7f9f17247713014b27/bin",
    "--libdir=/home/andrea/.local/state/cabal/store/ghc-9.6.7/Cabal-3.14.2.0-a95e1e8a8bc5e7fd4098d00c84207458f701bc6be999ca7f9f17247713014b27/lib",
    "--libsubdir=",
    "--dynlibdir=/home/andrea/.local/state/cabal/store/ghc-9.6.7/Cabal-3.14.2.0-a95e1e8a8bc5e7fd4098d00c84207458f701bc6be999ca7f9f17247713014b27/lib",
    "--libexecdir=/home/andrea/.local/state/cabal/store/ghc-9.6.7/Cabal-3.14.2.0-a95e1e8a8bc5e7fd4098d00c84207458f701bc6be999ca7f9f17247713014b27/libexec",
    "--libexecsubdir=",
    "--datadir=/home/andrea/.local/state/cabal/store/ghc-9.6.7/Cabal-3.14.2.0-a95e1e8a8bc5e7fd4098d00c84207458f701bc6be999ca7f9f17247713014b27/share",
    "--datasubdir=",
    "--docdir=/home/andrea/.local/state/cabal/store/ghc-9.6.7/Cabal-3.14.2.0-a95e1e8a8bc5e7fd4098d00c84207458f701bc6be999ca7f9f17247713014b27/share/doc",
    "--htmldir=/home/andrea/.local/state/cabal/store/ghc-9.6.7/Cabal-3.14.2.0-a95e1e8a8bc5e7fd4098d00c84207458f701bc6be999ca7f9f17247713014b27/share/doc/html",
    "--haddockdir=/home/andrea/.local/state/cabal/store/ghc-9.6.7/Cabal-3.14.2.0-a95e1e8a8bc5e7fd4098d00c84207458f701bc6be999ca7f9f17247713014b27/share/doc/html",
    "--sysconfdir=/home/andrea/.local/state/cabal/store/ghc-9.6.7/Cabal-3.14.2.0-a95e1e8a8bc5e7fd4098d00c84207458f701bc6be999ca7f9f17247713014b27/etc",
    "--enable-library-vanilla",
    "--disable-library-profiling",
    "--enable-shared",
    "--disable-static",
    "--disable-executable-dynamic",
    "--disable-executable-static",
    "--disable-profiling",
    "--disable-profiling-shared",
    "--profiling-detail=default",
    "--library-profiling-detail=default",
    "--enable-optimization",
    "--disable-debug-info",
    "--disable-build-info",
    "--disable-library-for-ghci",
    "--disable-split-sections",
    "--disable-split-objs",
    "--disable-executable-stripping",
    "--disable-library-stripping",
    "--package-db=clear",
    "--package-db=global",
    "--package-db=/home/andrea/.local/state/cabal/store/ghc-9.6.7/package.db",
    "--cid=Cabal-3.14.2.0-a95e1e8a8bc5e7fd4098d00c84207458f701bc6be999ca7f9f17247713014b27",
    "--dependency=Cabal-syntax=Cabal-syntax-3.14.2.0-be475844da27bcbf1c35aec7937d0c63838b3ad1bd46f667d32703da3106665e",
    "--dependency=array=array-0.5.8.0",
    "--dependency=base=base-4.18.3.0",
    "--dependency=bytestring=bytestring-0.11.5.4",
    "--dependency=containers=containers-0.6.7",
    "--dependency=deepseq=deepseq-1.4.8.1",
    "--dependency=directory=directory-1.3.8.5",
    "--dependency=filepath=filepath-1.4.301.0",
    "--dependency=mtl=mtl-2.3.1",
    "--dependency=parsec=parsec-3.1.16.1",
    "--dependency=pretty=pretty-1.1.3.6",
    "--dependency=process=process-1.6.19.0",
    "--dependency=time=time-1.12.2",
    "--dependency=transformers=transformers-0.6.1.0",
    "--dependency=unix=unix-2.8.6.0",
    "--disable-coverage",
    "--exact-configuration",
    "--disable-relocatable",
    "--with-ghc=/home/andrea/.ghcup/bin/ghc-9.6",
    "--with-ghc-pkg=/home/andrea/.ghcup/ghc/9.6.7/bin/ghc-pkg-9.6.7",
    "--ghc-option=-hide-all-packages",
    "lib:Cabal"
  ],
  "build-args": [
    "build"
  ],
  "copy-args": [
    "copy"
  ],
  "haddock-args": [
    "haddock"
  ],
  "test-args": [
    "test",
    "--log=$pkgid-$test-suite.log",
    "--machine-log=$pkgid.log",
    "--show-details=direct"
  ],
  "benchmark-args": [
    "bench"
  ],
  "repl-args": [
    "repl"
  ]
}

andreabedini and others added 3 commits January 13, 2026 13:50
Remove unused language extensions (BangPatterns, DeriveDataTypeable, etc.),
fix typo in function name (avaialbeTargetToJ -> availableTargetToJ), and
improve code formatting with eta reduction and simplified list syntax.
Include the exact Setup.hs invocations that cabal-install would use for
configure, build, copy, haddock, test, benchmark, and repl commands in
plan.json. This has the potential to reduce haskell.nix complexity by
eliminating the need to second-guess cabal-install's command-line generation.
@andreabedini
Copy link
Member Author

Ping @shlevy

@shlevy
Copy link
Contributor

shlevy commented Jan 19, 2026

I’m not sure why we’d merge this until we actually start consuming it somewhere. In geneeral I think we should either output structured info in order to construct our own Setup.hs invocation, or just invoke the planner in such a way that the invocation it gives us can be used as-is (e.g. with placeholder out for prefixes and proper unit IDs), but there’s not much use in this mixed state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants