rure: init at 0.2.1

Also regenerate hackage-packages.nix so it picks up on the newly added
library and remove the broken flag no haskell.packages.ghc921.regex-rure
which builds fine now (earlier GHC versions bundle incompatible
bytestring versions).
main
sternenseemann 2 years ago committed by sterni
parent d6e2f44abc
commit 452f76cfaf
  1. 3
      pkgs/development/haskell-modules/configuration-ghc-9.2.x.nix
  2. 2
      pkgs/development/haskell-modules/hackage-packages.nix
  3. 49
      pkgs/development/libraries/rure/Cargo.lock
  4. 41
      pkgs/development/libraries/rure/default.nix
  5. 5
      pkgs/development/libraries/rure/pin.json
  6. 51
      pkgs/development/libraries/rure/update.sh
  7. 2
      pkgs/top-level/all-packages.nix

@ -241,4 +241,7 @@ self: super: {
# https://github.com/sjakobi/bsb-http-chunked/issues/38
bsb-http-chunked = dontCheck super.bsb-http-chunked;
# need bytestring >= 0.11 which is only bundled with GHC >= 9.2
regex-rure = doDistribute (markUnbroken super.regex-rure);
}

@ -231650,7 +231650,7 @@ self: {
license = lib.licenses.agpl3Only;
hydraPlatforms = lib.platforms.none;
broken = true;
}) {rure = null;};
}) {inherit (pkgs) rure;};
"regex-tdfa" = callPackage
({ mkDerivation, array, base, bytestring, containers, directory

@ -0,0 +1,49 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
dependencies = [
"memchr",
]
[[package]]
name = "libc"
version = "0.2.113"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eef78b64d87775463c549fbd80e19249ef436ea3bf1de2a1eb7e717ec7fab1e9"
[[package]]
name = "memchr"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
name = "regex"
version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "rure"
version = "0.2.1"
dependencies = [
"libc",
"regex",
]

@ -0,0 +1,41 @@
{ lib
, stdenv
, rustPlatform
, fetchCrate
}:
let
pin = lib.importJSON ./pin.json;
in
rustPlatform.buildRustPackage {
inherit (pin) pname version;
src = fetchCrate pin;
# upstream doesn't ship a Cargo.lock, is generated by the update script
postPatch = ''
cp ${./Cargo.lock} Cargo.lock
'';
cargoLock.lockFile = ./Cargo.lock;
outputs = [ "out" "dev" ];
# Headers are not handled by cargo nor buildRustPackage
postInstall = ''
install -Dm644 include/rure.h -t "$dev/include"
'';
passthru.updateScript = ./update.sh;
meta = {
description = "A C API for Rust's regular expression library";
homepage = "https://crates.io/crates/rure";
license = [
lib.licenses.mit
lib.licenses.asl20
];
maintainers = [ lib.maintainers.sternenseemann ];
};
}

@ -0,0 +1,5 @@
{
"pname": "rure",
"version": "0.2.1",
"sha256": "18sd1dfagf2338mp32kfjbqpc3n0agm61p044jl7yhy299ws21r8"
}

@ -0,0 +1,51 @@
#!/usr/bin/env nix-shell
#! nix-shell -p nix jq curl cargo rsync
#! nix-shell -i bash
set -eu
cd "$(dirname "$0")"
crate=rure
echo "Getting latest version from crates.io API" >&2
curlOpts=(
-H "Accept: application/json"
-H "User-Agent: $crate update script (https://github.com/nixos/nixpkgs/)"
)
version="$(curl "${curlOpts[@]}" "https://crates.io/api/v1/crates/$crate" \
| jq -r .crate.max_stable_version)"
echo "Prefetching latest tarball from crates.io" >&2
url="https://crates.io/api/v1/crates/$crate/$version/download"
prefetch="$(nix-prefetch-url --print-path --type sha256 --unpack "$url")"
cat > pin.json <<EOF
{
"pname": "$crate",
"version": "$version",
"sha256": "$(printf '%s' "$prefetch" | head -n1)"
}
EOF
echo "Generating updated Cargo.lock" >&2
tmp="$(mktemp -d)"
cleanup() {
echo "Removing $tmp" >&2
rm -rf "$tmp"
}
trap cleanup EXIT
rsync -a --chmod=ugo=rwX "$(printf '%s' "$prefetch" | tail -n1)/" "$tmp"
pushd "$tmp"
cargo update
popd
cp "$tmp/Cargo.lock" ./Cargo.lock

@ -19696,6 +19696,8 @@ with pkgs;
rubberband = callPackage ../development/libraries/rubberband { };
rure = callPackage ../development/libraries/rure { };
rustc-demangle = callPackage ../development/libraries/rustc-demangle { };
s2geometry = callPackage ../development/libraries/s2geometry { };

Loading…
Cancel
Save