-
Notifications
You must be signed in to change notification settings - Fork 10
/
nix-alien.nix
76 lines (69 loc) · 1.99 KB
/
nix-alien.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{ lib
, fzf
, nix-filter
, nix-index
, nix-index-database-src
, nixpkgs-src
, python3
, version
}:
let
deps = (lib.importTOML ./pyproject.toml).project.dependencies;
python3' = python3.override {
packageOverrides = final: prev: {
icontract = prev.icontract.overrideAttrs (oldAttrs: {
# icontract is a dependency of pylddwrap, that has complex check
# dependencies (astor, deal, numpy...) but almost no runtime
# dependencies
# Disable its tests because it often breaks builds while bringing
# no actual advantage here
doInstallCheck = false;
});
pylddwrap = prev.pylddwrap.overrideAttrs (oldAttrs: {
# Fails to build in GitHub Actions, but works once it is build
# in a proper aarch64 system
doInstallCheck = false;
});
};
};
in
python3'.pkgs.buildPythonApplication {
inherit version;
pname = "nix-alien";
format = "pyproject";
src = nix-filter.lib {
root = ./.;
include = [
"nix_alien"
"tests"
"pyproject.toml"
"README.md"
"LICENSE"
];
};
nativeBuildInputs = [ fzf ];
propagatedBuildInputs = with python3'.pkgs; [
nix-index
setuptools
] ++ (lib.attrVals deps python3'.pkgs);
preBuild = ''
substituteInPlace nix_alien/_version.py \
--subst-var-by version ${version} \
--subst-var-by nixIndexDatabaseRev ${nix-index-database-src.rev} \
--subst-var-by nixpkgsRev ${nixpkgs-src.rev}
substituteInPlace {nix_alien,tests}/*.{py,nix} \
--subst-var-by nixpkgsLastModifiedDate ${nixpkgs-src.lastModifiedDate} \
--subst-var-by nixpkgsRev ${nixpkgs-src.rev} \
--subst-var-by nixpkgsHash ${nixpkgs-src.narHash}
'';
nativeCheckInputs = with python3'.pkgs; [
pytestCheckHook
];
meta = with lib; {
description = "Run unpatched binaries on Nix/NixOS";
homepage = "https://github.com/thiagokokada/nix-alien";
license = licenses.mit;
mainProgram = "nix-alien";
platforms = platforms.linux;
};
}