Skip to content

Commit

Permalink
fixing lief nix
Browse files Browse the repository at this point in the history
  • Loading branch information
qkaiser committed Oct 17, 2023
1 parent 9ffd128 commit 48d0b14
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 9 deletions.
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
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"
38 changes: 29 additions & 9 deletions overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,38 @@ inputs: final: prev:
hardeningDisable = (super.hardeningDisable or [ ]) ++ [ "fortify3" ];
});

# Lief 12.3 incompatibility with Cmake 3.26
# Own package updated independently of nixpkgs
jefferson = final.callPackage ./nix/jefferson { };

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"]'
outputs = [ "out" "py" ];

nativeBuildInputs = [
prev.cmake
prev.ninja
];

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

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

# Own package updated independently of nixpkgs
jefferson = final.callPackage ./nix/jefferson { };
postInstall = ''
pushd /build/source/api/python
${final.python3.interpreter} setup.py install --skip-build --root=/ --prefix=$py
popd
'';

});

python3 = prev.python3 // {
pkgs = prev.python3.pkgs.overrideScope
Expand Down

0 comments on commit 48d0b14

Please sign in to comment.