Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 31 additions & 110 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions nix/_sources/generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@
},
"version": "0.4.5"
},
"lief": {
"cargoLocks": null,
"date": null,
"extract": null,
"name": "lief",
"passthru": null,
"pinned": false,
"src": {
"deepClone": false,
"fetchSubmodules": false,
"leaveDotGit": false,
"name": null,
"owner": "lief-project",
"repo": "LIEF",
"rev": "0.13.2",
"sha256": "sha256-lH4SqwPB2Jp/wUI2Cll67PQbHbwMqpNuLy/ei8roiHg=",
"type": "github"
},
"version": "0.13.2"
},
"lzallright": {
"cargoLocks": {
"Cargo.lock": [
Expand Down
11 changes: 11 additions & 0 deletions nix/_sources/generated.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@
sha256 = "sha256-+cPOzzO3bCQAu8LrbjUJ5S/SR5OFitOYLIu5L9t/q+k=";
};
};
lief = {
pname = "lief";
version = "0.13.2";
src = fetchFromGitHub {
owner = "lief-project";
repo = "LIEF";
rev = "0.13.2";
fetchSubmodules = false;
sha256 = "sha256-lH4SqwPB2Jp/wUI2Cll67PQbHbwMqpNuLy/ei8roiHg=";
};
};
lzallright = {
pname = "lzallright";
version = "v0.2.3";
Expand Down
2 changes: 1 addition & 1 deletion nix/pyfatfs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ python3.pkgs.buildPythonApplication rec {

nativeBuildInputs = with python3.pkgs; [ pytest-runner setuptools-scm ];

propagatedBuildInputs = with python3.pkgs; [ fs ];
propagatedBuildInputs = with python3.pkgs; [ pip fs ];

postPatch = ''
substituteInPlace ./setup.py --replace 'setuptools_scm~=5.0.0' setuptools_scm
Expand Down
4 changes: 4 additions & 0 deletions nvfetcher.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ fetch.pypi = "treelib"
[pyfatfs]
src.pypi = "pyfatfs"
fetch.pypi = "pyfatfs"

[lief]
src.github_tag = "lief-project/LIEF"
fetch.github = "lief-project/LIEF"
69 changes: 59 additions & 10 deletions overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,68 @@ inputs: final: prev:
hardeningDisable = (super.hardeningDisable or [ ]) ++ [ "fortify3" ];
});

# Lief 12.3 incompatibility with Cmake 3.26
lief = prev.lief.overrideAttrs (super: {
postPatch = ''
substituteInPlace setup.py \
--replace \
'cmake_args = ["-DLIEF_FORCE_API_EXPORTS=ON", "-DLIEF_PYTHON_API=on"]' \
'cmake_args = ["-DLIEF_FORCE_API_EXPORTS=ON", "-DLIEF_PYTHON_API=on", "-DLIEF_EXAMPLES=off"]'
'';
});

# Own package updated independently of nixpkgs
jefferson = final.callPackage ./nix/jefferson { };

lief = prev.lief.overrideAttrs (super: with final; {

outputs = [ "out" "py" ];

nativeBuildInputs = [
cmake
ninja
];

# Not a propagatedBuildInput because only the $py output needs it; $out is
# just the library itself (e.g. C/C++ headers).
buildInputs = with python3.pkgs; [
python3
setuptools
tomli
];

CXXFLAGS = lib.optional stdenv.isLinux [ "-ffunction-sections" "-fdata-sections" "-fvisibility-inlines-hidden" "-static-libstdc++" "-static-libgcc" ]
++ lib.optional stdenv.isDarwin [ "-faligned-allocation" "-fno-aligned-new" "-fvisibility=hidden" ];

CFLAGS = lib.optional stdenv.isLinux [ "-ffunction-sections" "-fdata-sections" "-static-libstdc++" "-static-libgcc" ];
LDFLAGS = lib.optional stdenv.isLinux [ "-Wl,--gc-sections" "-Wl,--exclude-libs,ALL" ];


dontUseCmakeConfigure = true;

buildPhase = ''
runHook preBuild

mkdir -p build
cmake -S . -B build -GNinja -DCMAKE_LINK_WHAT_YOU_USE=on -DBUILD_SHARED_LIBS=on -DLIEF_INSTALL_COMPILED_EXAMPLES=off -DCMAKE_INSTALL_PREFIX=$out -DCMAKE_BUILD_TYPE=Release

cmake --build build --target all

runHook postBuild
'';

postBuild = ''
pushd api/python
${python3.interpreter} setup.py build --parallel=$NIX_BUILD_CORES
popd
'';

installPhase = ''
runHook preInstall

cmake --build build --target install

runHook postInstall
'';

postInstall = ''
pushd api/python
${python3.interpreter} setup.py install --skip-build --root=/ --prefix=$py
popd
'';

});

python3 = prev.python3 // {
pkgs = prev.python3.pkgs.overrideScope
(pyFinal: pyPrev: {
Expand Down