Skip to content

Commit e484a50

Browse files
rslawsonjaschuttepr2502
committed
Add Nix flake to ORFS.
Co-authored-by: jaschutte <[email protected]> Co-authored-by: max <[email protected]> Signed-off-by: Ryan Slawson <[email protected]>
1 parent 110d2d7 commit e484a50

File tree

3 files changed

+226
-3
lines changed

3 files changed

+226
-3
lines changed

flake.lock

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

flake.nix

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
4+
flake-utils.url = "github:numtide/flake-utils";
5+
openroad = {
6+
type = "git";
7+
url = "https://github.com/The-OpenROAD-Project/OpenROAD";
8+
submodules = true;
9+
rev = "ec1bf1a13902813b722f8341c432cd09714d9e55";
10+
};
11+
yosys = {
12+
type = "git";
13+
url = "https://github.com/The-OpenROAD-Project/yosys";
14+
submodules = true;
15+
rev = "c4b5190229616f7ebf8197f43990b4429de3e420";
16+
};
17+
};
18+
outputs = { self, nixpkgs, flake-utils, openroad, yosys }: flake-utils.lib.eachDefaultSystem (
19+
system:
20+
let
21+
pkgs = nixpkgs.legacyPackages.${system};
22+
in {
23+
devShells.default = pkgs.mkShell {
24+
buildInputs = [
25+
openroad.packages.${system}.default
26+
yosys.packages.${system}.default
27+
pkgs.klayout
28+
pkgs.verilator
29+
pkgs.python3
30+
pkgs.python3Packages.pandas
31+
pkgs.python3Packages.numpy
32+
pkgs.python3Packages.firebase-admin
33+
pkgs.python3Packages.click
34+
pkgs.python3Packages.pyyaml
35+
pkgs.python3Packages.yamlfix
36+
];
37+
};
38+
}
39+
);
40+
}

flow/Makefile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,27 @@ endif
232232
# Priority is given to
233233
# 1 user explicit set with variable in Makefile or command line, for instance setting OPENROAD_EXE
234234
# 2 ORFS compiled tools: openroad, yosys
235-
export OPENROAD_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/openroad)
236-
export OPENSTA_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/sta)
235+
ifneq (${IN_NIX_SHELL}, "")
236+
export OPENROAD_EXE := $(shell which openroad)
237+
else
238+
export OPENROAD_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/openroad)
239+
endif
240+
ifneq (${IN_NIX_SHELL}, "")
241+
export OPENSTA_EXE := $(shell which opensta)
242+
else
243+
export OPENSTA_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/opensta)
244+
endif
237245

238246
OPENROAD_ARGS = -no_init -threads $(NUM_CORES) $(OR_ARGS)
239247
OPENROAD_CMD = $(OPENROAD_EXE) -exit $(OPENROAD_ARGS)
240248
OPENROAD_NO_EXIT_CMD = $(OPENROAD_EXE) $(OPENROAD_ARGS)
241249
OPENROAD_GUI_CMD = $(OPENROAD_EXE) -gui $(OR_ARGS)
242250

243-
YOSYS_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/yosys/bin/yosys)
251+
ifneq (${IN_NIX_SHELL}, "")
252+
YOSYS_EXE := $(shell which yosys)
253+
else
254+
YOSYS_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/yosys/bin/yosys)
255+
endif
244256

245257
# Use locally installed and built klayout if it exists, otherwise use klayout in path
246258
KLAYOUT_DIR = $(abspath $(FLOW_HOME)/../tools/install/klayout/)

0 commit comments

Comments
 (0)