-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathflake.nix
More file actions
137 lines (135 loc) · 4.6 KB
/
Copy pathflake.nix
File metadata and controls
137 lines (135 loc) · 4.6 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
136
137
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
crane.url = "github:ipetkov/crane";
treefmt-nix.url = "github:numtide/treefmt-nix";
flake-root.url = "github:srid/flake-root";
};
outputs =
inputs@{
flake-parts,
crane,
nixpkgs,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } (
{ withSystem, flake-parts-lib, ... }:
let
inherit (flake-parts-lib) importApply;
tracexec.default = importApply ./nix/tracexec.nix { inherit crane; };
ukci.default = importApply ./nix/ukci.nix {
inherit nixpkgs;
inherit crane;
};
in
{
imports = [
tracexec.default
ukci.default
inputs.treefmt-nix.flakeModule
inputs.flake-root.flakeModule
];
flake = { };
systems = [
"x86_64-linux"
"aarch64-linux"
"riscv64-linux"
];
perSystem =
{
self',
config,
lib,
pkgs,
system,
...
}:
let
plotVerifierComplexity = pkgs.writeShellApplication {
name = "plot-verifier-complexity";
runtimeInputs = [
(pkgs.python3.withPackages (pythonPackages: [
pythonPackages.matplotlib
]))
];
text = ''
script="''${TRACEXEC_PLOT_VERIFIER_COMPLEXITY_SCRIPT:-scripts/plot-verifier-complexity.py}"
if [ ! -f "$script" ]; then
echo "plot-verifier-complexity: could not find $script" >&2
echo "run this from the tracexec repository root, or set TRACEXEC_PLOT_VERIFIER_COMPLEXITY_SCRIPT" >&2
exit 1
fi
exec python3 "$script" "$@"
'';
};
defaultShell = pkgs.mkShell {
name = "Development Shell";
packages =
with pkgs;
[
strace
nixfmt
statix
config.treefmt.build.wrapper
self'.packages.ukci
self'.packages.run-qemu
self'.packages.test-qemu
]
++ builtins.attrValues config.treefmt.build.programs;
shellHook = "export TRACEXEC_LOGLEVEL=debug";
};
in
{
packages.default = self'.packages.tracexec;
packages.plot-verifier-complexity = plotVerifierComplexity;
devShells.default = defaultShell;
devShells.extended = pkgs.mkShell {
inputsFrom = [ defaultShell ];
packages =
lib.optionals (system != "aarch64-linux") [
self'.packages.ukci-aarch64
self'.packages.run-qemu-aarch64
self'.packages.test-qemu-aarch64
]
++ lib.optionals (system != "x86_64-linux") [
self'.packages.ukci-x86_64
self'.packages.run-qemu-x86_64
self'.packages.test-qemu-x86_64
]
++ lib.optionals (system != "riscv64-linux") [
self'.packages.ukci-riscv64
self'.packages.run-qemu-riscv64
self'.packages.test-qemu-riscv64
];
};
devShells.cross = pkgs.mkShell {
inputsFrom = [ defaultShell ];
packages = [
self'.packages.ukci-latest-llvm
]
++ lib.optionals (system != "aarch64-linux") [
self'.packages.ukci-aarch64-latest-llvm
self'.packages.run-qemu-aarch64-latest-llvm
self'.packages.test-qemu-aarch64-latest-llvm
]
++ lib.optionals (system != "x86_64-linux") [
self'.packages.ukci-x86_64-latest-llvm
self'.packages.run-qemu-x86_64-latest-llvm
self'.packages.test-qemu-x86_64-latest-llvm
]
++ lib.optionals (system != "riscv64-linux") [
self'.packages.ukci-riscv64-latest-llvm
self'.packages.run-qemu-riscv64-latest-llvm
self'.packages.test-qemu-riscv64-latest-llvm
];
};
treefmt.config = {
inherit (config.flake-root) projectRootFile;
# formats .nix files
programs.nixfmt.enable = true;
};
};
}
);
}