-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: nix devshell #30679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
machshev
wants to merge
1
commit into
lowRISC:master
Choose a base branch
from
machshev:devshell
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,947
−0
Open
feat: nix devshell #30679
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| # Copyright lowRISC contributors (OpenTitan project). | ||
| # Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| { | ||
| description = "OpenTitan EDA development environment"; | ||
|
|
||
| inputs = { | ||
| # Pinned to nixos-26.05 to match lowrisc-nix and because that channel ships | ||
| # Verilator 5.048. | ||
| nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05"; | ||
| flake-utils.url = "github:numtide/flake-utils"; | ||
|
|
||
| # uv2nix builds the Python environment straight from this repo's | ||
| # pyproject.toml + uv.lock | ||
| pyproject-nix = { | ||
| url = "github:nix-community/pyproject.nix"; | ||
| inputs.nixpkgs.follows = "nixpkgs"; | ||
| }; | ||
|
|
||
| uv2nix = { | ||
| url = "github:pyproject-nix/uv2nix"; | ||
| inputs = { | ||
| pyproject-nix.follows = "pyproject-nix"; | ||
| nixpkgs.follows = "nixpkgs"; | ||
| }; | ||
| }; | ||
|
|
||
| pyproject-build-systems = { | ||
| url = "github:pyproject-nix/build-system-pkgs"; | ||
| inputs = { | ||
| pyproject-nix.follows = "pyproject-nix"; | ||
| uv2nix.follows = "uv2nix"; | ||
| nixpkgs.follows = "nixpkgs"; | ||
| }; | ||
| }; | ||
|
|
||
| # Provides mkEdaShell (the EDA devshell builder) | ||
| lowrisc-nix.url = "github:lowRISC/lowrisc-nix"; | ||
| }; | ||
|
|
||
| nixConfig = { | ||
| extra-substituters = ["https://nix-cache.lowrisc.org/public/"]; | ||
| extra-trusted-public-keys = ["nix-cache.lowrisc.org-public-1:O6JLD0yXzaJDPiQW1meVu32JIDViuaPtGDfjlOopU7o="]; | ||
| }; | ||
|
|
||
| outputs = { | ||
| nixpkgs, | ||
| flake-utils, | ||
| pyproject-nix, | ||
| uv2nix, | ||
| pyproject-build-systems, | ||
| lowrisc-nix, | ||
| ... | ||
| }: | ||
| flake-utils.lib.eachDefaultSystem (system: let | ||
| inherit (nixpkgs) lib; | ||
| pkgs = nixpkgs.legacyPackages.${system}; | ||
| python = pkgs.python312; | ||
|
|
||
| # OpenTitan's Python environment, built from this repo's own pyproject.toml | ||
| # + uv.lock. It bundles fusesoc and dvsim along with every other OpenTitan | ||
| # Python dependency, so the sim flow's `gen_sv_flist` step (which shells out | ||
| # to fusesoc) and dvsim itself are both on PATH inside the shell. | ||
| workspace = uv2nix.lib.workspace.loadWorkspace {workspaceRoot = ./.;}; | ||
| # Prefer prebuilt wheels: they need no per-package build-system overrides | ||
| # and are auto-patchelfed by pyproject.nix, which avoids building native | ||
| # deps (rpds-py/libcst's Rust, libclang, ...) from source. | ||
| overlay = workspace.mkPyprojectOverlay {sourcePreference = "wheel";}; | ||
| pythonSet = (pkgs.callPackage pyproject-nix.build.packages {inherit python;}) | ||
| .overrideScope ( | ||
| lib.composeManyExtensions [ | ||
| pyproject-build-systems.overlays.default | ||
| overlay | ||
| # Declares build systems for the sdist-only stragglers (crcmod, ...). | ||
| # Inert for deps that resolve to a prebuilt wheel above. | ||
| (lowrisc-nix.lib.pyprojectOverrides {inherit pkgs;}) | ||
| ] | ||
| ); | ||
| pythonEnv = pythonSet.mkVirtualEnv "opentitan-env" workspace.deps.default; | ||
|
|
||
| # Commercial EDA tool shell, built on lowrisc-nix's generic mkEdaShell. | ||
| # Enter with `nix develop .`. It execs into a hermetic FHS sandbox, so | ||
| # it is not direnv-loadable and must be entered explicitly. | ||
| # | ||
| # Tool install paths and license servers are supplied at *runtime* from the | ||
| # JSON file named by $LOWRISC_EDA_CONFIG (the flake only declares which | ||
| # vendor tools + versions are wanted); without that config the shell still | ||
| # works and just warns. See lowrisc-nix lib/README-eda.md. | ||
| eda = lowrisc-nix.lib.mkEdaShell { | ||
| inherit pkgs; | ||
| name = "opentitan-eda"; | ||
| tools = builtins.fromJSON (builtins.readFile ./tool_data.json); | ||
| # OpenTitan Python env (fusesoc, dvsim, ...) plus the open-source tools | ||
| # that ship in nixpkgs. Verilator 5.048 is the nixos-26.05 version, so no | ||
| # override is needed. | ||
| extraDeps = [pythonEnv]; | ||
| extraPkgs = [pkgs.verilator]; | ||
| }; | ||
| in { | ||
| packages.pythonEnv = pythonEnv; | ||
|
|
||
| devShells = { | ||
| inherit eda; | ||
| default = eda; | ||
| }; | ||
|
|
||
| formatter = pkgs.alejandra; | ||
| }); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| [ | ||
| { | ||
| "name": "AscentLint", | ||
| "vendor": "RealIntent", | ||
| "version": "2022.A.P23.1.2026_01_29", | ||
| "comment": "RTL lint (Real Intent Ascent Lint)." | ||
| }, | ||
| { | ||
| "name": "Jasper", | ||
| "vendor": "Cadence", | ||
| "version": "2025.09", | ||
| "comment": "Formal verification." | ||
| }, | ||
| { | ||
| "name": "MeridianCDC", | ||
| "vendor": "RealIntent", | ||
| "version": "2022.A.P24.3.2025_12_16", | ||
| "comment": "Clock-domain-crossing (CDC) analysis." | ||
| }, | ||
| { | ||
| "name": "MeridianRDC", | ||
| "vendor": "RealIntent", | ||
| "version": "2022.A.P14.4.RDC_.2025_12_16", | ||
| "comment": "Reset-domain-crossing (RDC) analysis." | ||
| }, | ||
| { | ||
| "name": "VCS", | ||
| "vendor": "Synopsys", | ||
| "version": "X-2025.06-SP2-1", | ||
| "comment": "RTL simulator." | ||
| }, | ||
| { | ||
| "name": "Vivado", | ||
| "vendor": "Xilinx", | ||
| "version": "2025.1", | ||
| "comment": "Used to build FPGA bitstreams." | ||
| }, | ||
| { | ||
| "name": "Xcelium", | ||
| "vendor": "Cadence", | ||
| "version": "24.03-s007", | ||
| "comment": "Provides xrun for simulations and is used to run our full UVM verification environment." | ||
| } | ||
| ] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add verible