Skip to content

Commit

Permalink
hyperscan: replacing wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
László Vaskó committed Nov 30, 2022
1 parent 3fb0ae0 commit dc331e1
Show file tree
Hide file tree
Showing 12 changed files with 275 additions and 172 deletions.
4 changes: 2 additions & 2 deletions .github/actions/setup-dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
inputs:
python-version:
description: 'Python version to setup'
description: "Python version to setup"
required: false
default: 3.8
runs:
using: "composite"
steps:
- name: Install 3rd party from apt
run: sudo apt install e2fsprogs p7zip-full unar zlib1g-dev liblzo2-dev lz4 lzop lziprecover img2simg libhyperscan5 libhyperscan-dev zstd
run: sudo apt install e2fsprogs p7zip-full unar zlib1g-dev liblzo2-dev lz4 lzop lziprecover img2simg zstd
shell: bash

- name: Install sasquatch
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
xz-utils \
zlib1g-dev \
libmagic1 \
libhyperscan5 \
libhyperscan-dev \
zstd
RUN curl -L -o sasquatch_1.0_amd64.deb https://github.com/onekey-sec/sasquatch/releases/download/sasquatch-v1.0/sasquatch_1.0_amd64.deb \
&& dpkg -i sasquatch_1.0_amd64.deb \
Expand Down
19 changes: 3 additions & 16 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
, mkPoetryApp
, poetry2nix
, glibc
, pyperscan
, python3
, rustPlatform
, e2fsprogs
Expand All @@ -16,7 +17,6 @@
, simg2img
, unar
, file
, hyperscan
, zstd
}:

Expand Down Expand Up @@ -72,24 +72,11 @@ let
'';
});

hyperscan = super.hyperscan.overridePythonAttrs (_: {
buildInputs = [
hyperscan
self.poetry
self.setuptools
];
nativeBuildInputs = [
pkg-config
];

installPhase = ''
${self.python.pythonForBuild.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache .
'';
});

arpy = overrideWithSetuptools super.arpy { };
yaffshiv = overrideWithSetuptools super.yaffshiv { };
ubi-reader = overrideWithSetuptools super.ubi-reader { };

inherit pyperscan;
});

python = python3;
Expand Down
105 changes: 105 additions & 0 deletions flake.lock

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

6 changes: 4 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.poetry2nix.url = "github:nix-community/poetry2nix";
inputs.poetry2nix.inputs.nixpkgs.follows = "nixpkgs";
inputs.pyperscan.url = "github:vlaci/pyperscan";
inputs.pyperscan.inputs.nixpkgs.follows = "nixpkgs";

inputs.sasquatch.url = "github:onekey-sec/sasquatch";
inputs.sasquatch.flake = false;

outputs = { self, nixpkgs, poetry2nix, sasquatch }:
outputs = { self, nixpkgs, poetry2nix, pyperscan, sasquatch }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
Expand All @@ -20,7 +22,7 @@
{
overlays.default = nixpkgs.lib.composeManyExtensions [
poetry2nix.overlay
(import ./overlay.nix { inherit sasquatch; })
(import ./overlay.nix { inherit pyperscan sasquatch; })
];

packages.${system} = {
Expand Down
1 change: 1 addition & 0 deletions overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ inputs: final: prev:

{
unblob = prev.callPackage ./. { };
pyperscan = prev.callPackage inputs.pyperscan.defaultPackage.${final.system} { };
gnustep = prev.callPackage ./nix/gnustep { inherit (prev) gnustep; };
sasquatch = prev.callPackage ./nix/sasquatch { inherit (prev) squashfsTools; src = inputs.sasquatch; };
mkPoetryApp = prev.callPackage ./nix/poetry { };
Expand Down
Loading

0 comments on commit dc331e1

Please sign in to comment.