Skip to content

Commit b2db0c3

Browse files
authored
Merge pull request #2938 from rslawson/add-nix-flake
Add Nix flake to ORFS.
2 parents d36a568 + c58c8c2 commit b2db0c3

File tree

3 files changed

+228
-3
lines changed

3 files changed

+228
-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: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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.time
28+
pkgs.klayout
29+
pkgs.verilator
30+
pkgs.perl
31+
pkgs.python3
32+
pkgs.python3Packages.pandas
33+
pkgs.python3Packages.numpy
34+
pkgs.python3Packages.firebase-admin
35+
pkgs.python3Packages.click
36+
pkgs.python3Packages.pyyaml
37+
pkgs.python3Packages.yamlfix
38+
];
39+
};
40+
}
41+
);
42+
}

flow/Makefile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,27 @@ endif
227227
# Priority is given to
228228
# 1 user explicit set with variable in Makefile or command line, for instance setting OPENROAD_EXE
229229
# 2 ORFS compiled tools: openroad, yosys
230-
export OPENROAD_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/openroad)
231-
export OPENSTA_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/sta)
230+
ifneq (${IN_NIX_SHELL},)
231+
export OPENROAD_EXE := $(shell command -v openroad)
232+
else
233+
export OPENROAD_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/openroad)
234+
endif
235+
ifneq (${IN_NIX_SHELL},)
236+
export OPENSTA_EXE := $(shell command -v sta)
237+
else
238+
export OPENSTA_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/OpenROAD/bin/sta)
239+
endif
232240

233241
OPENROAD_ARGS = -no_init -threads $(NUM_CORES) $(OR_ARGS)
234242
OPENROAD_CMD = $(OPENROAD_EXE) -exit $(OPENROAD_ARGS)
235243
OPENROAD_NO_EXIT_CMD = $(OPENROAD_EXE) $(OPENROAD_ARGS)
236244
OPENROAD_GUI_CMD = $(OPENROAD_EXE) -gui $(OR_ARGS)
237245

238-
YOSYS_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/yosys/bin/yosys)
246+
ifneq (${IN_NIX_SHELL},)
247+
YOSYS_EXE := $(shell command -v yosys)
248+
else
249+
YOSYS_EXE ?= $(abspath $(FLOW_HOME)/../tools/install/yosys/bin/yosys)
250+
endif
239251

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

0 commit comments

Comments
 (0)