haskellPackages.cabal2nix-unstable: don't wrap with runtime deps

cabal2nix-unstable is mostly used for regenerating the Haskell package
set. Thus we should aim to make it quick to rebuild in case its hash
changes because of Haskell related changes.

- cabal2nix is not fussy about the Nix version it uses for nix-env(1)
  and we can just assume it is already in PATH like we do for
  maintainers/scripts/haskell/*.

- nix-prefetch-scripts causes the most trouble since its python
  dependencies depend on pandoc, so many Haskell changes require
  an additional Python rebuild when building cabal2nix-unstable.

  nix-prefetch-scripts is most likely installed and not necessary in
  many cases, e.g. hackage2nix doesn't need them which is the main use
  we have for cabal2nix-unstable. For the update scripts that do need
  them, we add them to the used nix-shell explicitly.
This commit is contained in:
sternenseemann
2025-07-29 18:38:41 +02:00
parent 8fec8af67a
commit 7dfed14799
3 changed files with 2 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils curl jq gnused haskellPackages.cabal2nix-unstable.bin -I nixpkgs=.
#! nix-shell -i bash -p coreutils curl jq gnused haskellPackages.cabal2nix-unstable.bin nix-prefetch-scripts -I nixpkgs=.
# Updates cabal2nix-unstable to the latest master of the nixos/cabal2nix repository.
# See regenerate-hackage-packages.sh for details on the purpose of this script.

View File

@@ -1260,21 +1260,6 @@ builtins.intersectAttrs super {
# not used to link against by anyone, we can make its closure smaller and
# add its runtime dependencies in `haskellPackages` (as opposed to cabal2nix).
cabal2nix-unstable = overrideCabal (drv: {
buildTools = (drv.buildTools or [ ]) ++ [
pkgs.buildPackages.makeWrapper
];
postInstall = ''
${drv.postInstall or ""}
wrapProgram $out/bin/cabal2nix \
--prefix PATH ":" "${
pkgs.lib.makeBinPath [
pkgs.nix
pkgs.nix-prefetch-scripts
]
}"
'';
passthru = drv.passthru or { } // {
updateScript = ../../../maintainers/scripts/haskell/update-cabal2nix-unstable.sh;

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p cabal2nix curl jq haskellPackages.cabal2nix-unstable.bin -I nixpkgs=.
#!nix-shell -i bash -p cabal2nix curl jq haskellPackages.cabal2nix-unstable.bin nix-prefetch-scripts -I nixpkgs=.
#
# This script will update the spago derivation to the latest version using
# cabal2nix.