Skip to content

Commit ce7245b

Browse files
authored
Merge pull request #458 from onekey-sec/update-nix
Update nix dependencies, build using Poetry 1.2.1
2 parents 68a8a2f + 4e900ff commit ce7245b

File tree

3 files changed

+49
-56
lines changed

3 files changed

+49
-56
lines changed

default.nix

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -41,40 +41,46 @@ let
4141

4242
# Python dependencies that need special care, like non-python
4343
# build dependencies
44-
overrides = poetry2nix.overrides.withoutDefaults (self: super: {
45-
python-lzo = super.python-lzo.overridePythonAttrs (_: {
46-
buildInputs = [
47-
lzo
48-
];
49-
});
44+
overrides = poetry2nix.overrides.withoutDefaults (self: super:
45+
let
46+
# Inject setuptools to dependencies that is required by many non-wheel distributed packages
47+
overrideWithSetuptools = drv: overrides: (drv.overridePythonAttrs overrides).overridePythonAttrs (prev: {
48+
buildInputs = prev.buildInputs or [ ] ++ [
49+
self.setuptools
50+
];
51+
});
52+
in
53+
{
54+
python-lzo = overrideWithSetuptools super.python-lzo (_: {
55+
buildInputs = [
56+
lzo
57+
];
58+
});
5059

51-
jefferson = super.jefferson.overridePythonAttrs (_: {
52-
propagatedBuildInputs = [
53-
# Use the _same_ version as unblob
54-
self.cstruct
55-
self.python-lzo
56-
];
57-
});
60+
jefferson = overrideWithSetuptools super.jefferson (_: {
61+
propagatedBuildInputs = [
62+
# Use the _same_ version as unblob
63+
self.cstruct
64+
self.python-lzo
65+
];
66+
});
5867

59-
ubi_reader = super.ubi_reader.ovveridePythonAttrs (_: {
60-
propagatedBuildInputs = [
61-
# Use the _same_ version as unblob
62-
self.python-lzo
63-
];
64-
});
68+
python-magic = overrideWithSetuptools (super.python-magic.override { preferWheel = false; }) (_: {
69+
patchPhase = ''
70+
substituteInPlace magic/loader.py --replace "find_library('magic')" "'${file}/lib/libmagic.so'"
71+
'';
72+
});
6573

66-
python-magic = (super.python-magic.override { preferWheel = false; }).overridePythonAttrs (_: {
67-
patchPhase = ''
68-
substituteInPlace magic/loader.py --replace "find_library('magic')" "'${file}/lib/libmagic.so'"
69-
'';
70-
});
74+
hyperscan = super.hyperscan.overridePythonAttrs (_: {
75+
buildInputs = [
76+
hyperscan
77+
];
78+
});
7179

72-
hyperscan = super.hyperscan.overridePythonAttrs (_: {
73-
buildInputs = [
74-
hyperscan
75-
];
80+
arpy = overrideWithSetuptools super.arpy { };
81+
yaffshiv = overrideWithSetuptools super.yaffshiv { };
82+
ubi-reader = overrideWithSetuptools super.ubi-reader { };
7683
});
77-
});
7884

7985
python = python3;
8086

flake.lock

Lines changed: 9 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
55
inputs.poetry2nix.url = "github:nix-community/poetry2nix";
6+
inputs.poetry2nix.inputs.nixpkgs.follows = "nixpkgs";
67

78
inputs.sasquatch.url = "github:onekey-sec/sasquatch";
89
inputs.sasquatch.flake = false;
@@ -12,24 +13,23 @@
1213
system = "x86_64-linux";
1314
pkgs = import nixpkgs {
1415
inherit system;
15-
overlays = [ self.overlay ];
16+
overlays = [ self.overlays.default ];
1617
};
1718
inherit (pkgs) unblob;
1819
in
1920
{
20-
overlay = nixpkgs.lib.composeManyExtensions [
21+
overlays.default = nixpkgs.lib.composeManyExtensions [
2122
poetry2nix.overlay
2223
(import ./overlay.nix { inherit sasquatch; })
2324
];
2425

2526
packages.${system} = {
2627
inherit unblob;
2728
inherit (pkgs) sasquatch;
29+
default = unblob;
2830
};
2931

30-
defaultPackage.${system} = unblob;
31-
32-
devShell.${system} = import ./shell.nix { inherit pkgs; };
32+
devShells.${system}.default = import ./shell.nix { inherit pkgs; };
3333

3434
legacyPackages.${system} = pkgs;
3535
};

0 commit comments

Comments
 (0)