about summary refs log tree commit diff
path: root/pkgs/development/haskell-modules
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2022-03-20 11:43:37 +0100
committersternenseemann <sternenseemann@systemli.org>2022-03-20 11:43:37 +0100
commit4e4a88d03a8f4727693580aac837acdca54bd005 (patch)
tree6174b7caa82071dc5cc5983db85b0874a83f94b6 /pkgs/development/haskell-modules
parent6988f282e8d4b275a5e71f289acaf57f2957020b (diff)
downloadnixlib-4e4a88d03a8f4727693580aac837acdca54bd005.tar
nixlib-4e4a88d03a8f4727693580aac837acdca54bd005.tar.gz
nixlib-4e4a88d03a8f4727693580aac837acdca54bd005.tar.bz2
nixlib-4e4a88d03a8f4727693580aac837acdca54bd005.tar.lz
nixlib-4e4a88d03a8f4727693580aac837acdca54bd005.tar.xz
nixlib-4e4a88d03a8f4727693580aac837acdca54bd005.tar.zst
nixlib-4e4a88d03a8f4727693580aac837acdca54bd005.zip
haskell.package-list: only include versions that conform to PVP
Since this list is intended for Hackage, we need to make sure that only
packages with versions conforming to the PVP versioning scheme are
actually included in the CSV or Hackage will reject it.
Diffstat (limited to 'pkgs/development/haskell-modules')
-rw-r--r--pkgs/development/haskell-modules/package-list.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkgs/development/haskell-modules/package-list.nix b/pkgs/development/haskell-modules/package-list.nix
index 64f4be3a7722..688844bcc46c 100644
--- a/pkgs/development/haskell-modules/package-list.nix
+++ b/pkgs/development/haskell-modules/package-list.nix
@@ -1,10 +1,16 @@
 { runCommand, haskellPackages, lib, all-cabal-hashes, writeShellScript }:
 let
+  # Checks if the version looks like a Haskell PVP version which is the format
+  # Hackage enforces. This will return false if the version strings is empty or
+  # we've overridden the package to ship an unstable version of the package
+  # (sadly there's no good way to show something useful on hackage in this case).
+  isPvpVersion = v: builtins.match "([0-9]+)(\\.[0-9]+)*" v != null;
+
   pkgLine = name: pkg:
     let
       version = pkg.version or "";
     in
-    if version != "" then
+    if isPvpVersion version then
       ''"${name}","${version}","http://hydra.nixos.org/job/nixpkgs/trunk/haskellPackages.${name}.x86_64-linux"''
     else "";
   all-haskellPackages = builtins.toFile "all-haskellPackages" (lib.concatStringsSep "\n" (lib.filter (x: x != "") (lib.mapAttrsToList pkgLine haskellPackages)));