haskellPackages.cabal2nix-unstable: override with unstable dependencies

These dependencies need to be pulled from the same unstable commit that
cabal2nix is pulled from, otherwise changes to any of them will not be
in effect and possibly break the build.

(cherry picked from commit 631661e66c)
This commit is contained in:
Wolfgang Walther
2025-08-29 09:33:57 +02:00
parent 3f34a58e0c
commit 8a0284dcd2
8 changed files with 172 additions and 20 deletions

View File

@@ -12,8 +12,16 @@ head_info="$(curl -H "Accept: application/vnd.github.v3+json" https://api.github
commit="$(jq -r .commit.sha <<< "$head_info")"
# extract commit timestamp and convert to date
date="$(date "--date=$(jq -r .commit.commit.committer.date <<< "$head_info")" +%F)"
# generate nix expression from cabal file, replacing the version with the commit date
output=pkgs/development/haskell-modules/cabal2nix-unstable.nix
echo '# This file defines cabal2nix-unstable, used by maintainers/scripts/haskell/regenerate-hackage-packages.sh.' > "$output"
cabal2nix --subpath cabal2nix "https://github.com/NixOS/cabal2nix/archive/$commit.tar.gz" | sed -Ee 's/version = "(.*)"/version = "\1-unstable-'"$date"'"/' >> "$output"
nixfmt "$output"
function mkPackage() {
output=pkgs/development/haskell-modules/cabal2nix-unstable/$1.nix
echo "# This file defines $1-unstable, used by maintainers/scripts/haskell/regenerate-hackage-packages.sh." > "$output"
cabal2nix --subpath "$1" "https://github.com/NixOS/cabal2nix/archive/$commit.tar.gz" | sed -Ee 's/version = "(.*)"/version = "\1-unstable-'"$date"'"/' >> "$output"
nixfmt "$output"
}
mkPackage "cabal2nix"
mkPackage "distribution-nixpkgs"
mkPackage "hackage-db"
mkPackage "language-nix"