Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
92 lines (86 loc) · 3.01 KB
/
Copy pathflake.nix
File metadata and controls
92 lines (86 loc) · 3.01 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
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
{
description = "caliptra-ss Nix Packages and Environments";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
flake-utils.url = "github:numtide/flake-utils";
# Raw source of caliptra-rtl (flake = false ignores its flake.nix)
caliptra-rtl-src = {
url = "path:./third_party/caliptra-rtl";
flake = false;
};
##########
# PYTHON #
##########
pyproject-nix = {
url = "github:pyproject-nix/pyproject.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
pyproject-build-systems = {
url = "github:pyproject-nix/build-system-pkgs";
inputs.nixpkgs.follows = "nixpkgs";
inputs.pyproject-nix.follows = "pyproject-nix";
inputs.uv2nix.follows = "uv2nix";
};
uv2nix = {
url = "github:pyproject-nix/uv2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.pyproject-nix.follows = "pyproject-nix";
};
};
outputs = inputs: let
all_system_outputs = inputs.flake-utils.lib.eachDefaultSystem (system: let
pkgs = import inputs.nixpkgs {
inherit system;
};
python_dvsim = pkgs.callPackage (inputs.caliptra-rtl-src + "/tools/dvsim/python") {inherit inputs;};
python_reg_gen = pkgs.callPackage (inputs.caliptra-rtl-src + "/tools/scripts/python") {inherit inputs;};
# Environment variables derivable from the repo layout.
# Variables that cannot be auto-set here:
# CALIPTRA_WORKSPACE — user-specific parent dir for verilator scratch output
# RV_ROOT — external VeeR-EL2 checkout (not a submodule)
commonShellHook = ''
export CALIPTRA_ROOT="$(${pkgs.lib.getExe pkgs.git} rev-parse --show-toplevel)"
export ADAMSBRIDGE_ROOT="$CALIPTRA_ROOT/submodules/adams-bridge"
'';
in {
devShells = rec {
default = caliptra-dvsim;
caliptra-dvsim = pkgs.mkShell {
name = "caliptra-dvsim";
packages = ([
python_dvsim
]) ++ (with pkgs; [
uv
git # dvsim
]);
shellHook = commonShellHook + ''
mkdir -p "$CALIPTRA_ROOT/tools"
ln -sfn "../third_party/caliptra-rtl/tools/dvsim" "$CALIPTRA_ROOT/tools/dvsim"
'';
};
caliptra-reg-gen = pkgs.mkShell {
name = "caliptra-reg-gen";
packages = [
python_reg_gen
];
shellHook = commonShellHook;
};
};
});
in
all_system_outputs;
}