Skip to content

Conversation

hacker1024
Copy link
Member

Things done

This PR adds a few fixes and portability improvements to the mimalloc derivation.

  • Use the finalAttrs pattern to allow updating version and doCheck more effectively
  • Only build the shared library if the host platform supports it
  • Set MI_LIBC_MUSL for musl compatibility
  • Allow enabling MI_LOCAL_DYNAMIC_TLS, which is useful in some cases for shared libraries
  • Disable MI_OPT_ARCH, which is less accurate than Nixpkgs's own platform build flag system
  • Fix the MIMALLOC_LIBRARY_DIR and MIMALLOC_OBJECT_DIR variables, which are naively based on CMake file locations and reference the wrong output path
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux (static, musl)
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. labels Feb 8, 2025
Co-authored-by: kirillrdy <kirillrdy@gmail.com>
@hacker1024 hacker1024 requested a review from kirillrdy February 8, 2025 10:29
@wegank wegank added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Feb 9, 2025
@kirillrdy
Copy link
Member

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 380289


x86_64-linux

⏩ 4 packages marked as broken and skipped:
  • chatgpt-retrieval-plugin
  • chatgpt-retrieval-plugin.dist
  • hyprlandPlugins.hycov
  • hyprlandPlugins.hyprfocus
❌ 82 packages failed to build:
  • ansible-later
  • ansible-later.dist
  • ansible_2_16
  • ansible_2_16.dist
  • dbt (python312Packages.dbt-core)
  • dbt.dist (python312Packages.dbt-core.dist)
  • harlequin
  • harlequin.dist
  • kazumi
  • kazumi.debug
  • kazumi.pubcache
  • marimo (python312Packages.marimo)
  • marimo.dist (python312Packages.marimo.dist)
  • oneanime
  • oneanime.debug
  • oneanime.pubcache
  • open-webui
  • open-webui.dist
  • private-gpt
  • private-gpt.dist
  • python312Packages.altair
  • python312Packages.altair.dist
  • python312Packages.dbt-bigquery
  • python312Packages.dbt-bigquery.dist
  • python312Packages.dbt-postgres
  • python312Packages.dbt-postgres.dist
  • python312Packages.dbt-redshift
  • python312Packages.dbt-redshift.dist
  • python312Packages.dbt-snowflake
  • python312Packages.dbt-snowflake.dist
  • python312Packages.gradio
  • python312Packages.gradio.dist
  • python312Packages.great-expectations
  • python312Packages.great-expectations.dist
  • python312Packages.great-tables
  • python312Packages.great-tables.dist
  • python312Packages.narwhals
  • python312Packages.narwhals.dist
  • python312Packages.pandera
  • python312Packages.pandera.dist
  • python312Packages.private-gpt
  • python312Packages.private-gpt.dist
  • python312Packages.qcodes-contrib-drivers
  • python312Packages.qcodes-contrib-drivers.dist
  • python312Packages.skops
  • python312Packages.skops.dist
  • streamlit (python312Packages.streamlit)
  • streamlit.dist (python312Packages.streamlit.dist)
  • python312Packages.textual-fastdatatable
  • python312Packages.textual-fastdatatable.dist
  • python312Packages.txtai
  • python312Packages.txtai.dist
  • python312Packages.vega
  • python312Packages.vega.dist
  • python313Packages.altair
  • python313Packages.altair.dist
  • python313Packages.gradio
  • python313Packages.gradio.dist
  • python313Packages.great-expectations
  • python313Packages.great-expectations.dist
  • python313Packages.great-tables
  • python313Packages.great-tables.dist
  • python313Packages.marimo
  • python313Packages.marimo.dist
  • python313Packages.narwhals
  • python313Packages.narwhals.dist
  • python313Packages.pandera
  • python313Packages.pandera.dist
  • python313Packages.qcodes-contrib-drivers
  • python313Packages.qcodes-contrib-drivers.dist
  • python313Packages.skops
  • python313Packages.skops.dist
  • python313Packages.streamlit
  • python313Packages.streamlit.dist
  • python313Packages.textual-fastdatatable
  • python313Packages.textual-fastdatatable.dist
  • python313Packages.txtai
  • python313Packages.txtai.dist
  • python313Packages.vega
  • python313Packages.vega.dist
  • python313Packages.weaviate-client
  • python313Packages.weaviate-client.dist
✅ 171 packages built:
  • ansible (python312Packages.ansible-core)
  • ansible-lint
  • ansible-lint.dist
  • ansible-navigator
  • ansible-navigator.dist
  • ansible.dist (python312Packages.ansible-core.dist)
  • appdaemon
  • appdaemon.dist
  • art
  • dash-mpd-cli
  • deepdiff (python312Packages.deepdiff)
  • deepdiff.dist (python312Packages.deepdiff.dist)
  • flet-client-flutter
  • flet-client-flutter.debug
  • flet-client-flutter.pubcache
  • grimblast
  • hdrop
  • home-assistant-component-tests.apple_tv
  • home-assistant-component-tests.litterrobot
  • hyperspeedcube
  • hyprland
  • hyprland.dev
  • hyprland.man
  • hyprlandPlugins.borders-plus-plus
  • hyprlandPlugins.csgo-vulkan-fix
  • hyprlandPlugins.hy3
  • hyprlandPlugins.hypr-dynamic-cursors
  • hyprlandPlugins.hyprbars
  • hyprlandPlugins.hyprexpo
  • hyprlandPlugins.hyprgrass
  • hyprlandPlugins.hyprscroller
  • hyprlandPlugins.hyprspace
  • hyprlandPlugins.hyprsplit
  • hyprlandPlugins.hyprtrails
  • hyprlandPlugins.hyprwinwrap
  • hyprshade
  • hyprshade.dist
  • hyprshot
  • immich-machine-learning
  • immich-machine-learning.dist
  • mimalloc
  • mimalloc.dev
  • mold
  • mold-wrapped
  • molecule (python312Packages.molecule)
  • molecule.dist (python312Packages.molecule.dist)
  • napalm
  • napalm.dist
  • nwg-panel
  • nwg-panel.dist
  • openscad-unstable
  • peering-manager
  • poetry
  • poetry.dist
  • poetryPlugins.poetry-audit-plugin
  • poetryPlugins.poetry-audit-plugin.dist
  • poetryPlugins.poetry-plugin-export
  • poetryPlugins.poetry-plugin-export.dist
  • poetryPlugins.poetry-plugin-shell
  • poetryPlugins.poetry-plugin-shell.dist
  • poetryPlugins.poetry-plugin-up
  • poetryPlugins.poetry-plugin-up.dist
  • python312Packages.albumentations
  • python312Packages.albumentations.dist
  • python312Packages.ansible
  • python312Packages.ansible-compat
  • python312Packages.ansible-compat.dist
  • python312Packages.ansible-kernel
  • python312Packages.ansible-kernel.dist
  • python312Packages.ansible-runner
  • python312Packages.ansible-runner.dist
  • python312Packages.ansible-vault-rw
  • python312Packages.ansible-vault-rw.dist
  • python312Packages.ansible.dist
  • python312Packages.atsim-potentials
  • python312Packages.atsim-potentials.dist
  • python312Packages.dbt-adapters
  • python312Packages.dbt-adapters.dist
  • python312Packages.dbt-common
  • python312Packages.dbt-common.dist
  • python312Packages.dipy
  • python312Packages.dipy.dist
  • python312Packages.fastexcel
  • python312Packages.fastexcel.dist
  • python312Packages.flet-cli
  • python312Packages.flet-cli.dist
  • python312Packages.flet-desktop
  • python312Packages.flet-desktop.dist
  • python312Packages.flet-web
  • python312Packages.flet-web.dist
  • python312Packages.insightface
  • python312Packages.insightface.dist
  • python312Packages.jupysql
  • python312Packages.jupysql.dist
  • python312Packages.lancedb
  • python312Packages.lancedb.dist
  • python312Packages.napalm
  • python312Packages.napalm-hp-procurve
  • python312Packages.napalm-hp-procurve.dist
  • python312Packages.napalm-ros
  • python312Packages.napalm-ros.dist
  • python312Packages.napalm.dist
  • python312Packages.netbox-napalm-plugin
  • python312Packages.netbox-napalm-plugin.dist
  • python312Packages.polars
  • python312Packages.polars.dist
  • python312Packages.pyatv
  • python312Packages.pyatv.dist
  • python312Packages.pylance
  • python312Packages.pylance.dist
  • python312Packages.pylitterbot
  • python312Packages.pylitterbot.dist
  • python312Packages.pytest-ansible
  • python312Packages.pytest-ansible.dist
  • python312Packages.pytest-testinfra
  • python312Packages.pytest-testinfra.dist
  • python312Packages.qcodes
  • python312Packages.qcodes.dist
  • python312Packages.trx-python
  • python312Packages.trx-python.dist
  • ttp (python312Packages.ttp)
  • ttp.dist (python312Packages.ttp.dist)
  • python312Packages.unstructured
  • python312Packages.unstructured.dist
  • python312Packages.weaviate-client
  • python312Packages.weaviate-client.dist
  • python313Packages.albumentations
  • python313Packages.albumentations.dist
  • python313Packages.deepdiff
  • python313Packages.deepdiff.dist
  • python313Packages.dipy
  • python313Packages.dipy.dist
  • python313Packages.fastexcel
  • python313Packages.fastexcel.dist
  • python313Packages.flet-cli
  • python313Packages.flet-cli.dist
  • python313Packages.flet-desktop
  • python313Packages.flet-desktop.dist
  • python313Packages.flet-web
  • python313Packages.flet-web.dist
  • python313Packages.insightface
  • python313Packages.insightface.dist
  • python313Packages.jupysql
  • python313Packages.jupysql.dist
  • python313Packages.lancedb
  • python313Packages.lancedb.dist
  • python313Packages.polars
  • python313Packages.polars.dist
  • python313Packages.pyatv
  • python313Packages.pyatv.dist
  • python313Packages.pylance
  • python313Packages.pylance.dist
  • python313Packages.pylitterbot
  • python313Packages.pylitterbot.dist
  • python313Packages.qcodes
  • python313Packages.qcodes.dist
  • python313Packages.trx-python
  • python313Packages.trx-python.dist
  • python313Packages.unstructured
  • python313Packages.unstructured.dist
  • scap-security-guide
  • shaka-packager
  • sherlock
  • sherlock.dist
  • sublime-music
  • sublime-music.dist
  • sv-lang
  • universal-android-debloater
  • unstructured-api
  • waybar
  • xdg-desktop-portal-hyprland

++ lib.optionals (!doCheck) [ "-DMI_BUILD_TESTS=OFF" ];
cmakeFlags = [
(lib.cmakeBool "MI_INSTALL_TOPLEVEL" true)
(lib.cmakeBool "DMI_SECURE" secureBuild)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(lib.cmakeBool "DMI_SECURE" secureBuild)
(lib.cmakeBool "MI_SECURE" secureBuild)

Comment on lines +38 to +51
cmakeFlags = [
(lib.cmakeBool "MI_INSTALL_TOPLEVEL" true)
(lib.cmakeBool "DMI_SECURE" secureBuild)
(lib.cmakeBool "MI_BUILD_SHARED" (
!stdenv.hostPlatform.isStatic && stdenv.hostPlatform.hasSharedLibraries
))
(lib.cmakeBool "MI_LIBC_MUSL" (stdenv.hostPlatform.libc == "musl"))
(lib.cmakeBool "MI_LOCAL_DYNAMIC_TLS" localDynamicTLS)
(lib.cmakeBool "MI_BUILD_TESTS" finalAttrs.doCheck)

# MI_OPT_ARCH is inaccurate (e.g. it assumes aarch64 == armv8.1-a).
# Nixpkgs's native platform configuration does a better job.
(lib.cmakeBool "MI_OPT_ARCH" false)
];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an idea that I think might improve readability:

Suggested change
cmakeFlags = [
(lib.cmakeBool "MI_INSTALL_TOPLEVEL" true)
(lib.cmakeBool "DMI_SECURE" secureBuild)
(lib.cmakeBool "MI_BUILD_SHARED" (
!stdenv.hostPlatform.isStatic && stdenv.hostPlatform.hasSharedLibraries
))
(lib.cmakeBool "MI_LIBC_MUSL" (stdenv.hostPlatform.libc == "musl"))
(lib.cmakeBool "MI_LOCAL_DYNAMIC_TLS" localDynamicTLS)
(lib.cmakeBool "MI_BUILD_TESTS" finalAttrs.doCheck)
# MI_OPT_ARCH is inaccurate (e.g. it assumes aarch64 == armv8.1-a).
# Nixpkgs's native platform configuration does a better job.
(lib.cmakeBool "MI_OPT_ARCH" false)
];
cmakeFlags = lib.mapAttrsToList lib.cmakeBool {
MI_INSTALL_TOPLEVEL = true;
MI_SECURE = secureBuild;
MI_BUILD_SHARED = !stdenv.hostPlatform.isStatic && stdenv.hostPlatform.hasSharedLibraries;
MI_LIBC_MUSL = stdenv.hostPlatform.libc == "musl";
MI_LOCAL_DYNAMIC_TLS = localDynamicTLS;
MI_BUILD_TESTS = finalAttrs.doCheck;
# MI_OPT_ARCH is inaccurate (e.g. it assumes aarch64 == armv8.1-a).
# Nixpkgs's native platform configuration does a better job.
MI_OPT_ARCH = false;
};

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 16, 2025
@nixpkgs-ci nixpkgs-ci bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants