-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathflake.nix
More file actions
135 lines (122 loc) · 3.67 KB
/
Copy pathflake.nix
File metadata and controls
135 lines (122 loc) · 3.67 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Nix flake for smallworld-re.
#
# Reader's guide:
# - this file is intentionally small and mostly declarative
# - `nix/python-packages.nix` turns `uv.lock` into Nix Python packages
# - `nix/runtime-support.nix` assembles shells, runtime envs, and downstream helpers
# - `nix/panda-packages.nix` contains the PANDA-specific native build glue
#
# If you are new to Nix, the most important idea is:
# "inputs" says what external code we depend on, and "outputs" says what
# commands like `nix build` and `nix develop` expose to users.
{
description = "smallworld-re";
# External inputs. `follows` means "reuse the parent's copy" so we do not
# accidentally pull in multiple versions of the same dependency tree.
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
pyproject-nix = {
url = "github:pyproject-nix/pyproject.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
uv2nix = {
url = "github:pyproject-nix/uv2nix";
inputs.pyproject-nix.follows = "pyproject-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
pyproject-build-systems = {
url = "github:pyproject-nix/build-system-pkgs";
inputs.pyproject-nix.follows = "pyproject-nix";
inputs.uv2nix.follows = "uv2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# PANDA is the only major dependency that still needs custom Nix glue.
# See `nix/panda-packages.nix` for the explanation.
panda-ng = {
url = "github:panda-re/panda-ng";
inputs.nixpkgs.follows = "nixpkgs";
};
# Optional Binary Ninja support (uncomment both to enable).
# binaryninja = {
# url = "github:jchv/nix-binary-ninja";
# inputs.nixpkgs.follows = "nixpkgs";
# };
# binjaZip = {
# url = "path:./binaryninja_linux_stable_ultimate.zip";
# flake = false;
# };
};
outputs =
inputs@{
nixpkgs,
panda-ng,
pyproject-nix,
pyproject-build-systems,
uv2nix,
...
}:
let
lib = nixpkgs.lib;
supportedSystems = lib.systems.flakeExposed;
forEachSystem = lib.genAttrs supportedSystems;
pkgsFor = system: nixpkgs.legacyPackages.${system};
pythonFor = system: (pkgsFor system).python312;
pandaPackages = import ./nix/panda-packages.nix {
inherit
lib
forEachSystem
panda-ng
pkgsFor
;
};
aflplusplusPackages = import ./nix/aflplusplus-packages.nix {
inherit
lib
forEachSystem
pkgsFor
;
};
pythonPackages = import ./nix/python-packages.nix {
inherit
lib
forEachSystem
pkgsFor
pyproject-nix
pyproject-build-systems
pythonFor
uv2nix
;
pandaNgPackages = pandaPackages;
};
runtimeSupport = import ./nix/runtime-support.nix {
inherit
aflplusplusPackages
inputs
lib
pkgsFor
pythonFor
;
inherit (pythonPackages)
devSelection
mkLockedVirtualenv
mkPythonSet
mkSmallworldPythonModule
pythonSets
runtimeSelection
;
};
in
{
devShells = forEachSystem (system: {
default = runtimeSupport.mkDeveloperShell system;
lint = runtimeSupport.mkLintShell system;
});
packages = forEachSystem runtimeSupport.mkPackageOutputs;
# Small helper library for downstream flakes.
lib = {
mkPython = runtimeSupport.mkDownstreamPython;
mkPythonShell = runtimeSupport.mkDownstreamPythonShell;
};
formatter = forEachSystem (system: (pkgsFor system).nixfmt);
};
}