summary refs log tree commit diff
path: root/maintainers/scripts/haskell/regenerate-hackage-packages.sh
diff options
context:
space:
mode:
authorhyperfekt <git@hyperfekt.net>2020-05-04 01:01:57 +0200
committerMalte Brandy <malte.brandy@maralorn.de>2021-05-01 21:55:18 +0200
commitf3f84855e8fa9b190a14f49c5c6db9e816e72c10 (patch)
treedbdded4995b914d883b9ff546f3c1d31cce8e145 /maintainers/scripts/haskell/regenerate-hackage-packages.sh
parentee30de13b7730342a2bfe720c5877b6abf361172 (diff)
downloadnixpkgs-f3f84855e8fa9b190a14f49c5c6db9e816e72c10.tar
nixpkgs-f3f84855e8fa9b190a14f49c5c6db9e816e72c10.tar.gz
nixpkgs-f3f84855e8fa9b190a14f49c5c6db9e816e72c10.tar.bz2
nixpkgs-f3f84855e8fa9b190a14f49c5c6db9e816e72c10.tar.lz
nixpkgs-f3f84855e8fa9b190a14f49c5c6db9e816e72c10.tar.xz
nixpkgs-f3f84855e8fa9b190a14f49c5c6db9e816e72c10.tar.zst
nixpkgs-f3f84855e8fa9b190a14f49c5c6db9e816e72c10.zip
maintainers/scripts/haskell/regenerate-hackage-packages.sh: init
Introduces a script that can be used to update the Nix expressions for

the Haskell package set. In service of that, also

- introduces cabal2nix-latest, which pins the hackage2nix version used

- changes all-cabal-hashes to use fetchFromGitHub

- adds update-hackage.sh & update-cabal2nix-latest.sh & update-stackage.sh maintainer scripts
Diffstat (limited to 'maintainers/scripts/haskell/regenerate-hackage-packages.sh')
-rwxr-xr-xmaintainers/scripts/haskell/regenerate-hackage-packages.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/maintainers/scripts/haskell/regenerate-hackage-packages.sh b/maintainers/scripts/haskell/regenerate-hackage-packages.sh
new file mode 100755
index 00000000000..79b93f5b7cb
--- /dev/null
+++ b/maintainers/scripts/haskell/regenerate-hackage-packages.sh
@@ -0,0 +1,20 @@
+#! /usr/bin/env nix-shell
+#! nix-shell -i bash -p coreutils haskellPackages.cabal2nix-latest -I nixpkgs=.
+
+# This script is used to regenerate nixpkgs' Haskell package set, using a tool
+# called hackage2nix. hackage2nix looks at
+# pkgs/development/haskell-modules/configuration-hackage2nix.yaml and generates
+# a Nix expression for package version specified there, using the Cabal files
+# from the Hackage database (available under all-cabal-hashes) and its
+# companion tool cabal2nix.
+#
+# Related scripts are update-hackage.sh, for updating the snapshot of the
+# Hackage database used by hackage2nix, and update-cabal2nix-latest.sh,
+# for updating the version of hackage2nix used to perform this task.
+
+set -euo pipefail
+
+extractionDerivation='with import ./. {}; runCommand "unpacked-cabal-hashes" { } "tar xf ${all-cabal-hashes} --strip-components=1 --one-top-level=$out"'
+unpacked_hackage="$(nix-build -E "$extractionDerivation" --no-out-link)"
+
+hackage2nix --hackage "$unpacked_hackage" --preferred-versions <(for n in "$unpacked_hackage"/*/preferred-versions; do cat "$n"; echo; done) --nixpkgs "$PWD" --config pkgs/development/haskell-modules/configuration-hackage2nix.yaml