diff options
author | Alyssa Ross <hi@alyssa.is> | 2022-02-22 10:43:06 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2022-03-11 16:17:56 +0000 |
commit | ca1aada113c0ebda1ab8667199f6453f8e01c4fc (patch) | |
tree | 55e402280096f62eb0bc8bcad5ce6050c5a0aec7 /nixpkgs/pkgs/development/libraries/rure | |
parent | e4df5a52a6a6531f32626f57205356a773ac2975 (diff) | |
parent | 93883402a445ad467320925a0a5dbe43a949f25b (diff) | |
download | nixlib-ca1aada113c0ebda1ab8667199f6453f8e01c4fc.tar nixlib-ca1aada113c0ebda1ab8667199f6453f8e01c4fc.tar.gz nixlib-ca1aada113c0ebda1ab8667199f6453f8e01c4fc.tar.bz2 nixlib-ca1aada113c0ebda1ab8667199f6453f8e01c4fc.tar.lz nixlib-ca1aada113c0ebda1ab8667199f6453f8e01c4fc.tar.xz nixlib-ca1aada113c0ebda1ab8667199f6453f8e01c4fc.tar.zst nixlib-ca1aada113c0ebda1ab8667199f6453f8e01c4fc.zip |
Merge commit '93883402a445ad467320925a0a5dbe43a949f25b'
Conflicts: nixpkgs/nixos/modules/programs/ssh.nix nixpkgs/pkgs/applications/networking/browsers/firefox/packages.nix nixpkgs/pkgs/data/fonts/noto-fonts/default.nix nixpkgs/pkgs/development/go-modules/generic/default.nix nixpkgs/pkgs/development/interpreters/ruby/default.nix nixpkgs/pkgs/development/libraries/mesa/default.nix
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/rure')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/rure/Cargo.lock | 49 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/libraries/rure/default.nix | 41 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/libraries/rure/pin.json | 5 | ||||
-rwxr-xr-x | nixpkgs/pkgs/development/libraries/rure/update.sh | 51 |
4 files changed, 146 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/rure/Cargo.lock b/nixpkgs/pkgs/development/libraries/rure/Cargo.lock new file mode 100644 index 000000000000..ce760ae23315 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/rure/Cargo.lock @@ -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", +] diff --git a/nixpkgs/pkgs/development/libraries/rure/default.nix b/nixpkgs/pkgs/development/libraries/rure/default.nix new file mode 100644 index 000000000000..aef8b9c8f3e2 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/rure/default.nix @@ -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 ]; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/rure/pin.json b/nixpkgs/pkgs/development/libraries/rure/pin.json new file mode 100644 index 000000000000..234631d07c6e --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/rure/pin.json @@ -0,0 +1,5 @@ +{ + "pname": "rure", + "version": "0.2.1", + "sha256": "18sd1dfagf2338mp32kfjbqpc3n0agm61p044jl7yhy299ws21r8" +} diff --git a/nixpkgs/pkgs/development/libraries/rure/update.sh b/nixpkgs/pkgs/development/libraries/rure/update.sh new file mode 100755 index 000000000000..6e85d7cf03a7 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/rure/update.sh @@ -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 |