From bb1a701b72daccdb52e9fbbf97f817eaedd0a8eb Mon Sep 17 00:00:00 2001 From: Jared Baur Date: Wed, 19 Mar 2025 22:30:31 -0700 Subject: [PATCH 1/3] lief: nixfmt --- pkgs/development/libraries/lief/default.nix | 30 ++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/pkgs/development/libraries/lief/default.nix b/pkgs/development/libraries/lief/default.nix index 35256b17e939..ab1786cef936 100644 --- a/pkgs/development/libraries/lief/default.nix +++ b/pkgs/development/libraries/lief/default.nix @@ -1,13 +1,19 @@ -{ lib -, stdenv -, fetchFromGitHub -, python -, cmake -, ninja +{ + lib, + stdenv, + fetchFromGitHub, + python, + cmake, + ninja, }: let - pyEnv = python.withPackages (ps: [ ps.setuptools ps.tomli ps.pip ps.setuptools ]); + pyEnv = python.withPackages (ps: [ + ps.setuptools + ps.tomli + ps.pip + ps.setuptools + ]); in stdenv.mkDerivation rec { pname = "lief"; @@ -20,7 +26,10 @@ stdenv.mkDerivation rec { sha256 = "sha256-3rLnT/zs7YrAYNc8I2EJevl98LHGcXFf7bVlJJfxqRc="; }; - outputs = [ "out" "py" ]; + outputs = [ + "out" + "py" + ]; nativeBuildInputs = [ cmake @@ -55,6 +64,9 @@ stdenv.mkDerivation rec { homepage = "https://lief.quarkslab.com/"; license = [ licenses.asl20 ]; platforms = with platforms; linux ++ darwin; - maintainers = with maintainers; [ lassulus genericnerdyusername ]; + maintainers = with maintainers; [ + lassulus + genericnerdyusername + ]; }; } From cee41d8cc8641ddfc412001f828b542daf9b0aca Mon Sep 17 00:00:00 2001 From: Jared Baur Date: Wed, 19 Mar 2025 22:30:56 -0700 Subject: [PATCH 2/3] lief: modernize Use stdenv finalAttrs pattern and newer fetchFromGitHub arguments. --- pkgs/development/libraries/lief/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/lief/default.nix b/pkgs/development/libraries/lief/default.nix index ab1786cef936..edfab6d8d132 100644 --- a/pkgs/development/libraries/lief/default.nix +++ b/pkgs/development/libraries/lief/default.nix @@ -15,15 +15,15 @@ let ps.setuptools ]); in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "lief"; version = "0.16.4"; src = fetchFromGitHub { owner = "lief-project"; repo = "LIEF"; - rev = version; - sha256 = "sha256-3rLnT/zs7YrAYNc8I2EJevl98LHGcXFf7bVlJJfxqRc="; + tag = finalAttrs.version; + hash = "sha256-3rLnT/zs7YrAYNc8I2EJevl98LHGcXFf7bVlJJfxqRc="; }; outputs = [ @@ -69,4 +69,4 @@ stdenv.mkDerivation rec { genericnerdyusername ]; }; -} +}) From f341b4c39654deeb699e0a5fe933921d701f0f82 Mon Sep 17 00:00:00 2001 From: Jared Baur Date: Wed, 19 Mar 2025 22:32:13 -0700 Subject: [PATCH 3/3] lief: build shared library when stdenv is not static This makes the libLIEF library consistent with the package-set it is obtained from (i.e. `libLIEF.a` for `pkgs.pkgsStatic` and `libLIEF.so` for `pkgs`). --- pkgs/development/libraries/lief/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/lief/default.nix b/pkgs/development/libraries/lief/default.nix index edfab6d8d132..da7ea8898fc7 100644 --- a/pkgs/development/libraries/lief/default.nix +++ b/pkgs/development/libraries/lief/default.nix @@ -47,6 +47,8 @@ stdenv.mkDerivation (finalAttrs: { scikit-build-core ]; + cmakeFlags = [ (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) ]; + postBuild = '' pushd ../api/python ${pyEnv.interpreter} -m build --no-isolation --wheel --skip-dependency-check --config-setting=--parallel=$NIX_BUILD_CORES