← Back to Pull requests

libbase91: init at 0.3.3 #504524

Open
douzebis opened this pull request with 125 lines diff across 1 files
View on GitHub
douzebis douzebis commented on Mar 28, 2026 22:46 UTC
Author

Follows the update of base91 to 0.3.3 (#583594): this package takes
base91's source and vendored crates.

Add libbase91, the C library of base91-rs (the Rust library behind the
base91 command). base91 encodes binary data as printable ASCII with at
most 23% overhead (base64: 33%). The library offers two APIs, in
base91.h:

  • Henke's basE91 API (struct basE91, basE91_init, basE91_encode,

  • basE91_encode_end, basE91_decode, basE91_decode_end), binary
    compatible with Joachim Henke's basE91 0.6.0: a program built against
    his library runs unchanged with this one.
  • A one-shot API for both formats (base91_encode, base91_decode,

  • …), Henke's and a fixed-width SIMD variant that SSE4.1, AVX2 and NEON
    encode and decode at several GiB/s; no allocation, sizes checked before
    anything is written, errors as return codes with their offset.

    Homepage: https://github.com/douzebis/base91
    Changelog: https://github.com/douzebis/base91/blob/v0.3.3/CHANGELOG.md

    Packaging:

  • rustPlatform.buildRustPackage; the library is the rust/base91-capi

  • crate (cdylib and staticlib) of the workspace in rust/
    (cargoRoot, buildAndTestSubdir); its Rust tests run in the check
    phase.
  • inherit (base91) version src cargoDeps: no second fetch or vendor

  • hash; one nix-update base91 moves both packages.
  • Outputs out (lib/libbase91.so.0, SONAME libbase91.so.0, with the

  • libbase91.so link; lib/libbase91.a) and dev (include/base91.h,
    lib/pkgconfig/base91.pc, with Libs.private for the static library);
    meta.pkgConfigModules; fixDarwinDylibNames on Darwin.
  • passthru.tests: pkg-config (testers.hasPkgConfigModules); c-api,

  • a C program calling every function through pkg-config, linked
    dynamically and statically; henke-compat, Henke's own basE91 0.6.0
    command-line tool built against this library, which must write exactly
    what base91 writes, small buffers included (they overlap its input and
    output).
  • meta.license: MIT, and BSD-3-Clause for the header, which declares

  • Henke's API.

    This PR previously proposed 0.2.2, built from Henke's C code with a
    hand-written buildPhase (mdaniels5757 suggested the generic builder
    with make install). The library is now built from the Rust code with
    cargo, so that suggestion no longer applies: the recipe has no build or
    install phase of its own.

    Things done

  • Built on platform:

  • - [x] x86_64-linux
    - [ ] aarch64-linux
    - [ ] aarch64-darwin
  • Tested, as applicable:

  • - [ ] [NixOS tests] in [nixos/tests].
    - [x] [Package tests] at passthru.tests.
    - [ ] Tests in [lib/tests] or [pkgs/test] for functions and "core" functionality.
  • Ran nixpkgs-review on this PR. See [nixpkgs-review usage].

  • - (A new package with no dependents: built it and its passthru.tests
    directly.)
  • Tested basic functionality of all binary files, usually in ./result/bin/.

  • - (No binaries; the passthru.tests exercise the library from C.)
  • Nixpkgs Release Notes

  • - [ ] Package update: when the change is major or breaking.
  • NixOS Release Notes

  • - [ ] Module addition: when adding a new NixOS module.
    - [ ] Module update: when the change is significant.
  • Fits [CONTRIBUTING.md], [pkgs/README.md], [maintainers/README.md] and other READMEs.

  • Follows the [automation/AI policy].
  • AI disclosure

    This package was prepared with Claude Code (Claude Opus 5.5): the
    packaging, the commit message and this description were drafted with it
    and reviewed by me, the maintainer, who is responsible for them. The
    commit carries an Assisted-by: trailer.

    [NixOS tests]: https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests
    [Package tests]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests
    [nixpkgs-review usage]: https://github.com/Mic92/nixpkgs-review#usage

    [CONTRIBUTING.md]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md
    [automation/AI policy]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#automationai-policy
    [lib/tests]: https://github.com/NixOS/nixpkgs/blob/master/lib/tests
    [maintainers/README.md]: https://github.com/NixOS/nixpkgs/blob/master/maintainers/README.md
    [nixos/tests]: https://github.com/NixOS/nixpkgs/blob/master/nixos/tests
    [pkgs/README.md]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md
    [pkgs/test]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/test

    🤖 Generated with Claude Code

    Diff: 125 lines (+125 / -0) across 1 files Reviewer: douzebis Review duration: 359467m
    All Vouch review confidence checks passed
    Residual risk 0.10 = Change Risk (0.53) × (1 − Review Confidence (0.81)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.53 · 125 lines diff across 1 files
    0.53
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.89 · 5 substantive comment(s)
    0.89
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    81%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.289
    Self Review self_review
    0.140
    Real PR Conversation Timeline
    23 items
    Copilot Copilot commented on code on Apr 01, 2026 15:25 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,46 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +  llvmPackages,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";

    PR title/description indicates init at 0.2.1, but the derivation sets version = "0.2.2". Please align the package version with the intended release (either update the PR metadata or change this version/tag).

    Copilot Copilot commented on code on Apr 01, 2026 15:26 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,46 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +  llvmPackages,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";
    +  };
    +
    +  sourceRoot = "${finalAttrs.src.name}/src";
    +
    +  nativeBuildInputs = [
    +    llvmPackages.clang
    +    llvmPackages.bintools
    +  ];
    +
    +  buildPhase = ''
    +    clang -O2 -fPIC -shared -o libbase91.so base91.c
    +    clang -O2 -c base91.c -o base91.o
    +    llvm-ar crs libbase91.a base91.o
    +  '';
    +
    +  installPhase = ''
    +    mkdir -p $out/lib $out/include
    +    cp libbase91.so libbase91.a $out/lib/

    This derivation hardcodes ELF-specific output (libbase91.so) and uses clang -shared, but meta.platforms = lib.platforms.unix includes Darwin where shared libraries are .dylib and -shared is not the right flag. Either restrict platforms to ELF targets (e.g., linux) or make the build/install name and linker flags conditional on stdenv.hostPlatform (Darwin/ELF/BSD).

        libname=${if stdenv.hostPlatform.isDarwin then "libbase91.dylib" else "libbase91.so"}
        clang -O2 -fPIC ${if stdenv.hostPlatform.isDarwin then "-dynamiclib" else "-shared"} -o "$libname" base91.c
        clang -O2 -c base91.c -o base91.o
        llvm-ar crs libbase91.a base91.o
      '';
    
      installPhase = ''
        libname=${if stdenv.hostPlatform.isDarwin then "libbase91.dylib" else "libbase91.so"}
        mkdir -p $out/lib $out/include
        cp "$libname" libbase91.a $out/lib/
    

    Copilot Copilot commented on code on Apr 01, 2026 15:26 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,46 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +  llvmPackages,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";
    +  };
    +
    +  sourceRoot = "${finalAttrs.src.name}/src";
    +
    +  nativeBuildInputs = [
    +    llvmPackages.clang
    +    llvmPackages.bintools
    +  ];
    +
    +  buildPhase = ''
    +    clang -O2 -fPIC -shared -o libbase91.so base91.c
    +    clang -O2 -c base91.c -o base91.o
    +    llvm-ar crs libbase91.a base91.o
    +  '';

    The build phase bypasses the toolchain provided by stdenv by calling clang/llvm-ar directly. This makes cross-compilation and toolchain overrides harder. Prefer using $CC and $AR (and any relevant NIX_ flags) and drop the explicit llvmPackages. inputs unless there is a specific need for clang/llvm-ar.

    Copilot Copilot commented on code on Apr 01, 2026 15:26 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,46 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +  llvmPackages,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";
    +  };
    +
    +  sourceRoot = "${finalAttrs.src.name}/src";
    +
    +  nativeBuildInputs = [
    +    llvmPackages.clang
    +    llvmPackages.bintools
    +  ];
    +
    +  buildPhase = ''
    +    clang -O2 -fPIC -shared -o libbase91.so base91.c
    +    clang -O2 -c base91.c -o base91.o
    +    llvm-ar crs libbase91.a base91.o
    +  '';
    +
    +  installPhase = ''
    +    mkdir -p $out/lib $out/include
    +    cp libbase91.so libbase91.a $out/lib/
    +    cp base91.h $out/include/
    +  '';

    The PR description says man pages (basE91.3, basE91_encode.3, etc.) should be produced/installed, but the installPhase only installs the library and header. If the upstream release includes these manpages, please install them into $out/share/man/man3 (and add a man output if this repo uses split outputs). Otherwise, the PR description/test plan should be updated to match what the derivation actually installs.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Apr 01, 2026 15:26 UTC
    Reviewer

    Pull request overview

    Adds a new Nix package definition for the libbase91 C library, intended to build/install shared + static libraries, headers, and (per PR description) manpage documentation.

    Changes:

  • Introduces pkgs/by-name/li/libbase91/package.nix to fetch douzebis/base91 and build libbase91.so / libbase91.a.

  • Installs base91.h into $out/include and libraries into $out/lib.

  • Sets package metadata (homepage, changelog, license, maintainers, platforms).
  • ---

    💡 <a href="/NixOS/nixpkgs/new/master?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.

    douzebis douzebis commented on code on Apr 01, 2026 15:40 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,46 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +  llvmPackages,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";

    Fixed: the derivation is already at version = "0.2.2". PR title and description updated to match.

    douzebis douzebis commented on code on Apr 01, 2026 15:40 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,46 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +  llvmPackages,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";
    +  };
    +
    +  sourceRoot = "${finalAttrs.src.name}/src";
    +
    +  nativeBuildInputs = [
    +    llvmPackages.clang
    +    llvmPackages.bintools
    +  ];
    +
    +  buildPhase = ''
    +    clang -O2 -fPIC -shared -o libbase91.so base91.c
    +    clang -O2 -c base91.c -o base91.o
    +    llvm-ar crs libbase91.a base91.o
    +  '';
    +
    +  installPhase = ''
    +    mkdir -p $out/lib $out/include
    +    cp libbase91.so libbase91.a $out/lib/

    Fixed: buildPhase and installPhase now use stdenv.hostPlatform.isDarwin to select -dynamiclib/.dylib on Darwin and -shared/.so on Linux.

    douzebis douzebis commented on code on Apr 01, 2026 15:40 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,46 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +  llvmPackages,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";
    +  };
    +
    +  sourceRoot = "${finalAttrs.src.name}/src";
    +
    +  nativeBuildInputs = [
    +    llvmPackages.clang
    +    llvmPackages.bintools
    +  ];
    +
    +  buildPhase = ''
    +    clang -O2 -fPIC -shared -o libbase91.so base91.c
    +    clang -O2 -c base91.c -o base91.o
    +    llvm-ar crs libbase91.a base91.o
    +  '';

    Fixed: dropped llvmPackages.clang and llvmPackages.bintools from inputs; buildPhase now uses $CC and $AR from stdenv.

    douzebis douzebis commented on code on Apr 01, 2026 15:40 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,46 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +  llvmPackages,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";
    +  };
    +
    +  sourceRoot = "${finalAttrs.src.name}/src";
    +
    +  nativeBuildInputs = [
    +    llvmPackages.clang
    +    llvmPackages.bintools
    +  ];
    +
    +  buildPhase = ''
    +    clang -O2 -fPIC -shared -o libbase91.so base91.c
    +    clang -O2 -c base91.c -o base91.o
    +    llvm-ar crs libbase91.a base91.o
    +  '';
    +
    +  installPhase = ''
    +    mkdir -p $out/lib $out/include
    +    cp libbase91.so libbase91.a $out/lib/
    +    cp base91.h $out/include/
    +  '';

    The upstream repo does not include man pages for the C library. PR description updated to remove the man page claim.

    Copilot Copilot commented on code on Apr 01, 2026 15:49 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,49 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";
    +  };
    +
    +  sourceRoot = "${finalAttrs.src.name}/src";
    +
    +  buildPhase =
    +    let
    +      sharedLib = if stdenv.hostPlatform.isDarwin then "libbase91.dylib" else "libbase91.so";
    +      sharedFlags = if stdenv.hostPlatform.isDarwin then "-dynamiclib" else "-shared";
    +    in
    +    ''
    +      $CC -O2 -fPIC ${sharedFlags} -o ${sharedLib} base91.c
    +      $CC -O2 -c base91.c -o base91.o

    On Darwin, the produced libbase91.dylib is linked without setting an install_name (LC_ID_DYLIB). This commonly leads to consumers recording a non-store install name (often just libbase91.dylib), which can break runtime loading/linking in Nix environments. Please pass an explicit install name when building the dylib (e.g., via -Wl,-install_name,$out/lib/${sharedLib} or an @rpath-based install name consistent with the repo’s conventions).

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Apr 01, 2026 15:49 UTC
    Reviewer

    Pull request overview

    Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

    ---

    💡 <a href="/NixOS/nixpkgs/new/master?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.

    douzebis douzebis commented on code on Apr 01, 2026 15:58 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,49 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";
    +  };
    +
    +  sourceRoot = "${finalAttrs.src.name}/src";
    +
    +  buildPhase =
    +    let
    +      sharedLib = if stdenv.hostPlatform.isDarwin then "libbase91.dylib" else "libbase91.so";
    +      sharedFlags = if stdenv.hostPlatform.isDarwin then "-dynamiclib" else "-shared";
    +    in
    +    ''
    +      $CC -O2 -fPIC ${sharedFlags} -o ${sharedLib} base91.c
    +      $CC -O2 -c base91.c -o base91.o

    Fixed: added -Wl,-install_name,$out/lib/libbase91.dylib on Darwin and -Wl,-soname,libbase91.so on Linux.

    Copilot Copilot commented on code on Apr 01, 2026 16:02 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,53 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";
    +  };
    +
    +  sourceRoot = "${finalAttrs.src.name}/src";
    +
    +  buildPhase =
    +    let
    +      sharedLib = if stdenv.hostPlatform.isDarwin then "libbase91.dylib" else "libbase91.so";
    +      sharedFlags =
    +        if stdenv.hostPlatform.isDarwin then
    +          "-dynamiclib -Wl,-install_name,$out/lib/libbase91.dylib"
    +        else
    +          "-shared -Wl,-soname,libbase91.so";
    +    in
    +    ''
    +      $CC -O2 -fPIC ${sharedFlags} -o ${sharedLib} base91.c
    +      $CC -O2 -c base91.c -o base91.o
    +      $AR crs libbase91.a base91.o
    +    '';

    Custom buildPhase does not call runHook preBuild/postBuild. Omitting these hooks can break stdenv features and user overrides (e.g., hardening or wrapper hooks) that rely on them. Please add the standard hooks around the manual compile commands (and similarly for install).

    Copilot Copilot commented on code on Apr 01, 2026 16:02 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,53 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";
    +  };
    +
    +  sourceRoot = "${finalAttrs.src.name}/src";
    +
    +  buildPhase =
    +    let
    +      sharedLib = if stdenv.hostPlatform.isDarwin then "libbase91.dylib" else "libbase91.so";
    +      sharedFlags =
    +        if stdenv.hostPlatform.isDarwin then
    +          "-dynamiclib -Wl,-install_name,$out/lib/libbase91.dylib"
    +        else
    +          "-shared -Wl,-soname,libbase91.so";
    +    in
    +    ''
    +      $CC -O2 -fPIC ${sharedFlags} -o ${sharedLib} base91.c
    +      $CC -O2 -c base91.c -o base91.o
    +      $AR crs libbase91.a base91.o
    +    '';
    +
    +  installPhase =
    +    let
    +      sharedLib = if stdenv.hostPlatform.isDarwin then "libbase91.dylib" else "libbase91.so";
    +    in
    +    ''
    +      mkdir -p $out/lib $out/include
    +      cp ${sharedLib} libbase91.a $out/lib/
    +      cp base91.h $out/include/

    Custom installPhase does not call runHook preInstall/postInstall. Adding these hooks improves compatibility with stdenv and package overrides that extend install behavior. (Optional but recommended.)

        ''
          runHook preInstall
          mkdir -p $out/lib $out/include
          cp ${sharedLib} libbase91.a $out/lib/
          cp base91.h $out/include/
          runHook postInstall
    

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Apr 01, 2026 16:02 UTC
    Reviewer

    Pull request overview

    Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

    ---

    💡 <a href="/NixOS/nixpkgs/new/master?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.

    douzebis douzebis commented on code on Apr 01, 2026 16:20 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,53 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";
    +  };
    +
    +  sourceRoot = "${finalAttrs.src.name}/src";
    +
    +  buildPhase =
    +    let
    +      sharedLib = if stdenv.hostPlatform.isDarwin then "libbase91.dylib" else "libbase91.so";
    +      sharedFlags =
    +        if stdenv.hostPlatform.isDarwin then
    +          "-dynamiclib -Wl,-install_name,$out/lib/libbase91.dylib"
    +        else
    +          "-shared -Wl,-soname,libbase91.so";
    +    in
    +    ''
    +      $CC -O2 -fPIC ${sharedFlags} -o ${sharedLib} base91.c
    +      $CC -O2 -c base91.c -o base91.o
    +      $AR crs libbase91.a base91.o
    +    '';

    Fixed: added runHook preBuild/runHook postBuild around the compile commands.

    douzebis douzebis commented on code on Apr 01, 2026 16:20 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,53 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";
    +  };
    +
    +  sourceRoot = "${finalAttrs.src.name}/src";
    +
    +  buildPhase =
    +    let
    +      sharedLib = if stdenv.hostPlatform.isDarwin then "libbase91.dylib" else "libbase91.so";
    +      sharedFlags =
    +        if stdenv.hostPlatform.isDarwin then
    +          "-dynamiclib -Wl,-install_name,$out/lib/libbase91.dylib"
    +        else
    +          "-shared -Wl,-soname,libbase91.so";
    +    in
    +    ''
    +      $CC -O2 -fPIC ${sharedFlags} -o ${sharedLib} base91.c
    +      $CC -O2 -c base91.c -o base91.o
    +      $AR crs libbase91.a base91.o
    +    '';
    +
    +  installPhase =
    +    let
    +      sharedLib = if stdenv.hostPlatform.isDarwin then "libbase91.dylib" else "libbase91.so";
    +    in
    +    ''
    +      mkdir -p $out/lib $out/include
    +      cp ${sharedLib} libbase91.a $out/lib/
    +      cp base91.h $out/include/

    Fixed: added runHook preInstall/runHook postInstall around the install commands.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Apr 01, 2026 16:24 UTC
    Reviewer

    Pull request overview

    Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

    ---

    💡 <a href="/NixOS/nixpkgs/new/master?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.

    seanybaggins seanybaggins commented on Apr 07, 2026 18:44 UTC
    Contributor

    Hi @douzebis apologies for late reply. I was on a trip. May I ask why you are requesting my review? I don't have write privileges to the nixpkgs project or have reviewed any packages within nixpkgs.

    douzebis douzebis commented on Apr 07, 2026 18:52 UTC
    Author

    Hi @seanybaggins, I used the Reviewers "wheel" and clicked on a random name for a review. Apologies, I should probably have known better.

    mdaniels5757 mdaniels5757 commented on code on Apr 08, 2026 01:26 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,57 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";
    +  };
    +
    +  sourceRoot = "${finalAttrs.src.name}/src";
    +
    +  buildPhase =
    +    let
    +      sharedLib = if stdenv.hostPlatform.isDarwin then "libbase91.dylib" else "libbase91.so";
    +      sharedFlags =
    +        if stdenv.hostPlatform.isDarwin then
    +          "-dynamiclib -Wl,-install_name,$out/lib/libbase91.dylib"
    +        else
    +          "-shared -Wl,-soname,libbase91.so";
    +    in
    +    ''
    +      runHook preBuild
    +      $CC -O2 -fPIC ${sharedFlags} -o ${sharedLib} base91.c
    +      $CC -O2 -c base91.c -o base91.o
    +      $AR crs libbase91.a base91.o
    +      runHook postBuild
    +    '';
    +
    +  installPhase =
    +    let
    +      sharedLib = if stdenv.hostPlatform.isDarwin then "libbase91.dylib" else "libbase91.so";
    +    in
    +    ''
    +      runHook preInstall
    +      mkdir -p $out/lib $out/include
    +      cp ${sharedLib} libbase91.a $out/lib/
    +      cp base91.h $out/include/
    +      runHook postInstall
    +    '';

    Most of this code is not needed: the stdenv generic builder does most of the work by calling make and make install. One thing that is missing is that make install does not install the header file. Ordinarily this would require a patch or a postInstall = ''cp ... ...'' type thing, but here, since you are also upstream, I can simply ask: can you make make install install the header file too? :)

      __structuredAttrs = true;
      strictDeps = true;
    
      sourceRoot = "${finalAttrs.src.name}/src";
      installFlags = [ "prefix=${placeholder "out"}" ];
    

    douzebis douzebis commented on code on Nov 05, 2026 17:04 UTC
    Code Review
    pkgs/by-name/li/libbase91/package.nix:1
    @@ -0,0 +1,57 @@
    +{
    +  lib,
    +  stdenv,
    +  fetchFromGitHub,
    +}:
    +
    +stdenv.mkDerivation (finalAttrs: {
    +  pname = "libbase91";
    +  version = "0.2.2";
    +
    +  src = fetchFromGitHub {
    +    owner = "douzebis";
    +    repo = "base91";
    +    tag = "v${finalAttrs.version}";
    +    hash = "sha256-aul68hDvEriSOUAutJkboeP7rzLcZGC7va39GVqKmig=";
    +  };
    +
    +  sourceRoot = "${finalAttrs.src.name}/src";
    +
    +  buildPhase =
    +    let
    +      sharedLib = if stdenv.hostPlatform.isDarwin then "libbase91.dylib" else "libbase91.so";
    +      sharedFlags =
    +        if stdenv.hostPlatform.isDarwin then
    +          "-dynamiclib -Wl,-install_name,$out/lib/libbase91.dylib"
    +        else
    +          "-shared -Wl,-soname,libbase91.so";
    +    in
    +    ''
    +      runHook preBuild
    +      $CC -O2 -fPIC ${sharedFlags} -o ${sharedLib} base91.c
    +      $CC -O2 -c base91.c -o base91.o
    +      $AR crs libbase91.a base91.o
    +      runHook postBuild
    +    '';
    +
    +  installPhase =
    +    let
    +      sharedLib = if stdenv.hostPlatform.isDarwin then "libbase91.dylib" else "libbase91.so";
    +    in
    +    ''
    +      runHook preInstall
    +      mkdir -p $out/lib $out/include
    +      cp ${sharedLib} libbase91.a $out/lib/
    +      cp base91.h $out/include/
    +      runHook postInstall
    +    '';

    Hi @mdaniels5757 , thank you very much for your review.
    At very long last I reworked and hopefully fixed the PR.
    Please would you like to give it another look.

    Reviewers
    Assignees
    douzebis douzebis
    Labels
    risk: low confidence: 81.3% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52.9% (MEDIUM) · Higher = larger blast radius
    52.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 81.3% · Lower = rushed or shallow review
    81.3%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 9.9% · Safe to merge
    9.9%
    Repository