Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ runCommand, haskellPackages, lib, all-cabal-hashes, writeShellScript }: 2let 3 # Checks if the version looks like a Haskell PVP version which is the format 4 # Hackage enforces. This will return false if the version strings is empty or 5 # we've overridden the package to ship an unstable version of the package 6 # (sadly there's no good way to show something useful on hackage in this case). 7 isPvpVersion = v: builtins.match "([0-9]+)(\\.[0-9]+)*" v != null; 8 9 pkgLine = name: pkg: 10 let 11 version = pkg.version or ""; 12 in 13 lib.optionalString (isPvpVersion version) 14 ''"${name}","${version}","http://hydra.nixos.org/job/nixpkgs/trunk/haskellPackages.${name}.x86_64-linux"''; 15 all-haskellPackages = builtins.toFile "all-haskellPackages" (lib.concatStringsSep "\n" (lib.filter (x: x != "") (lib.mapAttrsToList pkgLine haskellPackages))); 16in 17runCommand "hackage-package-list" { } 18 # This command will make a join between all packages on hackage and haskellPackages.*. 19 # It creates a valid csv file which can be uploaded to hackage.haskell.org. 20 # The call is wrapped in echo $(...) to trim trailing newline, which hackage requires. 21 '' 22 mkdir -p $out/bin 23 echo -n "$(tar -t -f ${all-cabal-hashes} | sed 's![^/]*/\([^/]*\)/.*!"\1"!' | sort -u | join -t , - ${all-haskellPackages})" > $out/nixos-hackage-packages.csv 24 ''