Skip to content
This repository was archived by the owner on Aug 18, 2026. It is now read-only.

Commit 367e2e3

Browse files
committed
+user@updatability(Bonfire): bump to 1.0.6.beta-4
1 parent 8ced9ed commit 367e2e3

50 files changed

Lines changed: 5721 additions & 25273 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pkgs/by-name/bonfire/deps/evision.nix

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
which,
88
python3,
99
elixir,
10+
fetchFromGitHub,
1011
enableOpenCVContrib ? true,
1112
# FixMe(functional/completeness): test whether CUDA actually works. CUDA is not free software.
1213
cudaSupport ? config.cudaSupport,
@@ -15,29 +16,27 @@
1516
}:
1617
finalMixPkgs: previousMixPkgs: {
1718
evision = previousMixPkgs.evision.overrideAttrs (
18-
finalAttrs: previousAttrs: {
19+
finalAttrs: previousAttrs:
20+
let
21+
src = fetchFromGitHub {
22+
owner = "cocoa-xu";
23+
repo = "evision";
24+
rev = "v${finalAttrs.version}";
25+
hash = "sha256-3iek3FQBIrauJ2x7Ph9RCkdSH7kePamff+ycjKNBGuM=";
26+
};
27+
in
28+
{
29+
inherit src;
1930
# Explanation: to build, evision.so requires:
2031
# 1. OPENCV_CONFIGURATION_PRIVATE_HPP, a private CPP header from opencv.src
21-
# 2. C_SRC_HEADERS_TXT, a list of CPP headers from python_bindings_generator
32+
# 2. C_SRC_HEADERS_TXT, a JSON file listing CPP headers from python_bindings_generator
2233
postUnpack = previousAttrs.postUnpack or "" + ''
34+
cp -av --no-preserve=mode ${src}/py_src $sourceRoot
2335
cp -at $sourceRoot/c_src/ \
2436
${finalAttrs.passthru.opencv.src}/modules/core/include/opencv2/core/utils/configuration.private.hpp \
25-
${finalAttrs.passthru.opencv}/modules/python_bindings_generator/headers${lib.optionalString enableOpenCVContrib "-contrib"}.txt
37+
${finalAttrs.passthru.opencv}/modules/python_bindings_generator/gen_python_config${lib.optionalString enableOpenCVContrib "-contrib"}.json
2638
'';
2739

28-
patches = [
29-
# Explanation: avoid errors caused by missing flann symbols.
30-
# See https://github.com/cocoa-xu/evision/issues/293
31-
# Revert [PATCH] commented out `cvflann::flann_distance_t` conversion
32-
(fetchpatch2 {
33-
name = "commented-out-cvflann-flann_distance_t-conversion
34-
-functions";
35-
url = "https://github.com/cocoa-xu/evision/commit/4ae5c62ca591e0a0fadb5dcd90ed5149bddfc7c0.patch";
36-
hash = "sha256-+vM6swrqIK9Xz2R8kRSR+BeF7wBvW6x6d0N/+9FnO5E=";
37-
revert = true;
38-
})
39-
];
40-
4140
# Explanation: skip complex rules of the Makefile to build opencv,
4241
# and let cmake use the opencv provided by nix.
4342
postPatch = previousAttrs.postPatch or "" + ''

pkgs/by-name/bonfire/deps/evision/opencv.nix

Lines changed: 58 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
lib,
33
fetchFromGitHub,
44
fetchpatch2,
5+
jq,
56
python3,
67
python3Packages,
78
enableContrib ? true,
89
enableCuda ? false,
910
apply_patch_py,
11+
sysprof,
12+
libsysprof-capture,
1013
...
1114
}:
1215
let
@@ -24,59 +27,67 @@ in
2427
}).overrideAttrs
2528
(
2629
finalAttrs: previousAttrs: {
27-
# Explanation: nixpkgs's opencv-4.12.0 is not (yet) supported by evision-0.2.14
28-
# and more specifically, gen2.py's flags where changed substantialy in opencv-4.12.0:
29-
# https://github.com/opencv/opencv/pull/27325
30-
#
31-
# ToDo(maintenance/update): once evision supports opencv-4.12.0
32-
# this version may be able to match nixpkgs' version.
33-
version = "4.11.0";
30+
# Explanation: match evision-0.2.17's `OPENCV_VER`
31+
version = "4.13.0";
3432

3533
src = fetchFromGitHub {
3634
owner = "opencv";
3735
repo = "opencv";
3836
tag = finalAttrs.version;
39-
hash = "sha256-oiU4CwoMfuUbpDtujJVTShMCzc5GsnIaprC4DzkSzEM=";
37+
hash = "sha256-h9gpSf+xf/OafQSCYq3JYBt/ShnxafSG7WbxesTjM/A=";
4038
};
41-
patches = [
42-
# ToDo(maintenance/update): remove this patch on opencv-4.12.0
43-
#
44-
# Explanation: frontporting opencv-4.11.0 to nixos-25.11
45-
# stumbles on the new ffmpeg-8 in nixos-25.11.
46-
# Issue: https://github.com/opencv/opencv/issues/27688
47-
(fetchpatch2 {
48-
name = "FFmpeg 8.0 support";
49-
url = "https://github.com/opencv/opencv/pull/27691.patch";
50-
hash = "sha256-wRL2mLxclO5NpWg1rBKso/8oTO13I5XJ6pEW+Y3PsPc=";
51-
})
39+
/*
40+
patches = [
41+
# ToDo(maintenance/update): remove this patch on opencv-4.12.0
42+
#
43+
# Explanation: frontporting opencv-4.11.0 to nixos-25.11
44+
# stumbles on the new ffmpeg-8 in nixos-25.11.
45+
# Issue: https://github.com/opencv/opencv/issues/27688
46+
(fetchpatch2 {
47+
name = "FFmpeg 8.0 support";
48+
url = "https://github.com/opencv/opencv/pull/27691.patch";
49+
hash = "sha256-wRL2mLxclO5NpWg1rBKso/8oTO13I5XJ6pEW+Y3PsPc=";
50+
})
5251
53-
# ToDo(maintenance/update): remove this patch on opencv-4.12.0
54-
#
55-
# Explanation: frontporting opencv-4.11.0 to nixos-25.11
56-
# stumbles on the new cmake-4 in nixos-25.11,
57-
# which deprecated too old cmake_minimum_required() in CMakeLists.txt
58-
# that BUILD_JASPER=ON + WITH_ADE=ON still expects.
59-
(fetchpatch2 {
60-
name = "Fix configuring with CMake version 4";
61-
url = "https://github.com/opencv/opencv/pull/27192.patch";
62-
hash = "sha256-1yzOU9xR5LmdxzczM4sXuDyZ/DCLJApAQMUQE2mmAlg=";
63-
})
64-
];
52+
# ToDo(maintenance/update): remove this patch on opencv-4.12.0
53+
#
54+
# Explanation: frontporting opencv-4.11.0 to nixos-25.11
55+
# stumbles on the new cmake-4 in nixos-25.11,
56+
# which deprecated too old cmake_minimum_required() in CMakeLists.txt
57+
# that BUILD_JASPER=ON + WITH_ADE=ON still expects.
58+
(fetchpatch2 {
59+
name = "Fix configuring with CMake version 4";
60+
url = "https://github.com/opencv/opencv/pull/27192.patch";
61+
hash = "sha256-1yzOU9xR5LmdxzczM4sXuDyZ/DCLJApAQMUQE2mmAlg=";
62+
})
63+
];
64+
*/
6565

66-
# Explanation: nixos-25.11#opencv4's contribSrc's version
66+
# Explanation: nixos-26.05#opencv4's contribSrc's version
6767
# is not using finalAttrs.version
6868
# so override postUnpack with the correct one.
6969
opencvContribSrc = fetchFromGitHub {
7070
owner = "opencv";
7171
repo = "opencv_contrib";
7272
tag = finalAttrs.version;
73-
hash = "sha256-YNd96qFJ8SHBgDEEsoNps888myGZdELbbuYCae9pW3M=";
73+
hash = "sha256-8YRCq1H9afb1a0pVevH0x61SMW4dTpLAno/P9A6bOIg=";
7474
};
7575
postUnpack = ''
76-
cp --no-preserve=mode -r "${finalAttrs.opencvContribSrc}/modules" "$NIX_BUILD_TOP/source/opencv_contrib"
76+
cp --no-preserve=mode -r "${finalAttrs.opencvContribSrc}/modules" "$sourceRoot/opencv_contrib"
77+
# Required for apply_patch to find `opencv_contrib`,
78+
# eg. for `patch_ocr_tesseract_run_with_components`
79+
mkdir $sourceRoot/opencv_contrib-${finalAttrs.version}
80+
ln -s ../opencv_contrib $sourceRoot/opencv_contrib-${finalAttrs.version}/modules
7781
'';
7882

79-
nativeBuildInputs = previousAttrs.nativeBuildInputs or [ ] ++ [ python3 ];
83+
nativeBuildInputs = previousAttrs.nativeBuildInputs or [ ] ++ [
84+
jq
85+
python3
86+
];
87+
buildInputs = previousAttrs.buildInputs or [ ] ++ [
88+
sysprof
89+
libsysprof-capture
90+
];
8091

8192
# Explanation(compatibility): evision has an unusual way to patch opencv:
8293
# a Python script.
@@ -190,18 +201,22 @@ in
190201
# > from the python module in the OpenCV repo so that they output header files
191202
# > that can be used in Elixir bindings
192203
#
193-
# For that evision needs a headers.txt generated for Python
204+
# For that evision needs a gen_python_config.json generated for Python
194205
# listing the .hpp files to consider.
195206
# Unfortunately those files are absolute path in $NIX_BUILD_TOP,
196-
# they need to be fixed to point to $out, and installed there.
207+
# they need to be fixed to point to somewhere in $out.
208+
# Note that $out/include/ cannot be used reliably
209+
# since some headers are not installed at all yet required by evision.
197210
postInstall = previousAttrs.postInstall or "" + ''
198-
OPENCV_HEADERS_TXT=$NIX_BUILD_TOP/$sourceRoot/build/modules/python_bindings_generator/headers.txt
211+
pushd "$NIX_BUILD_TOP/$sourceRoot"
212+
find . \( -name "*.hpp" -or -name "*.h" \) \
213+
-exec sh -xc 'install -Dm644 -t$out/source/''${1%/*} $1' -- {} \;
214+
OPENCV_HEADERS="build/modules/python_bindings_generator/gen_python_config.json"
199215
mkdir -p $out/modules/python_bindings_generator/
200-
while IFS= read -r header; do
201-
h=$(realpath --relative-to "$NIX_BUILD_TOP" "$header")
202-
install -Dm644 "$header" "$out/$h"
203-
echo "$out/$h"
204-
done <"$OPENCV_HEADERS_TXT" >$out/modules/python_bindings_generator/headers${lib.optionalString enableContrib "-contrib"}.txt
216+
jq '.headers |= map(sub("^'"$NIX_BUILD_TOP"'"; "'$out'"))' \
217+
<"$OPENCV_HEADERS" \
218+
>$out/modules/python_bindings_generator/gen_python_config${lib.optionalString enableContrib "-contrib"}.json
219+
popd
205220
'';
206221
}
207222
)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
From 10bad143bed89fd55d7a2c3cdfa977f59b7cfe1e Mon Sep 17 00:00:00 2001
2+
From: Julien Moutinho <julm@sourcephile.fr>
3+
Date: Thu, 9 Jul 2026 00:13:05 +0200
4+
Subject: [PATCH] Fix compatibility with Erlang/OTP 28
5+
6+
Erlang/OTP 28 no longer allows regexes to be defined in the module body and interpolated into an attribute.
7+
8+
Closes: https://github.com/kipcole9/text/issues/3
9+
---
10+
lib/pii.ex | 11 +++++------
11+
1 file changed, 5 insertions(+), 6 deletions(-)
12+
13+
diff --git a/lib/pii.ex b/lib/pii.ex
14+
index 029159f..9363fe9 100644
15+
--- a/lib/pii.ex
16+
+++ b/lib/pii.ex
17+
@@ -29,7 +29,7 @@ defmodule Text.PII do
18+
19+
"""
20+
21+
- @patterns [
22+
+ defp patterns do [
23+
email: ~r/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/,
24+
url: ~r{\bhttps?://[^\s<>"']+},
25+
ssn: ~r/\b\d{3}-\d{2}-\d{4}\b/,
26+
@@ -43,14 +43,13 @@ defmodule Text.PII do
27+
# Always re-validated by Luhn before being reported.
28+
credit_card: ~r/\b(?:\d[ \-]?){12,18}\d\b/
29+
]
30+
-
31+
- @types Keyword.keys(@patterns)
32+
+ end
33+
34+
@doc """
35+
Returns the list of detector type atoms supported by this module.
36+
"""
37+
@spec types() :: [atom()]
38+
- def types, do: @types
39+
+ def types, do: Keyword.keys(patterns())
40+
41+
@doc """
42+
Detects PII matches in the text.
43+
@@ -85,9 +84,9 @@ defmodule Text.PII do
44+
%{type: atom(), value: String.t(), start: non_neg_integer(), length: pos_integer()}
45+
]
46+
def detect(text, options \\ []) when is_binary(text) do
47+
- requested = Keyword.get(options, :types, @types)
48+
+ requested = Keyword.get(options, :types, types())
49+
50+
- @patterns
51+
+ patterns()
52+
|> Enum.filter(fn {type, _} -> type in requested end)
53+
|> Enum.flat_map(fn {type, regex} ->
54+
Regex.scan(regex, text, return: :index)

0 commit comments

Comments
 (0)