Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 25 additions & 18 deletions .github/workflows/github-actions-cron-update-OR.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are there changes to this action and .github/workflows/github-actions-cron-update-yosys.yml ? I don't think they have anything to do with nix.

Copy link
Contributor Author

@rslawson rslawson Apr 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's because if any of the submodules change, so do their hashes. Then it won't match the one in flake.lock, and so trying to open a dev shell will fail. Users can rectify this by running nix flake update, but I thought it might be nice to update the file automatically in CI whenever OR or Yosys are updated. I have assumed, though, that none of their submodules (both abc submodules, OpenSTA, cxxopts) will never be updated independently of their parents. If that's a bad assumption it may be necessary to add more CI actions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vvbandeira does this make sense to include? My interest is spending any effort on nix is quite low so this should be zero hassle to adopt.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather not add Nix to the existing GHAs; this will add a dependency we do not officially support. I am okay with adding a new GHA to test Nix, but it should be noted that it will be the responsibility of Nix users to maintain it, and we do not intend to offer any support for Nix-related problems at this time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair enough, I'll revert those changes and write up something to test the Nix flake. I'll also include an update to documentation somewhere that indicates what to do if building the flake fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, additional question: when you say it's okay to add a new GHA to text Nix, do you mean specifically only that? As in I should not use it to update flake.lock, and instead instruct users to do so?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rslawson, apologies for the long delay.
You can create a new GHA that creates a draft PR to update the flake.lock; we would accept it.
My concern with adding to the existing PRs is that there could be a case where we want to merge the PR that automates the OR submodule, but for some reason, the GHA is not working/failing due to Nix.

Copy link
Contributor Author

@rslawson rslawson Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vvbandeira No worries at all, I've had very little time to work on personal projects for a bit now. I'll see about making those changes as soon as I am able.

Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,28 @@ jobs:
git checkout master
git pull
- if: "steps.remote-update.outputs.has_update != ''"
name: Create Draft PR
uses: peter-evans/create-pull-request@v7
with:
token: ${{ github.token }}
signoff: true
delete-branch: true
title: 'Update OpenROAD submodule'
body: |
Automated action to update tools/OpenROAD submodule and tighten CI rule checking.
[ci:rules-tighten]
labels: UpdateRules
reviewers: |
vvbandeira
maliberty
draft: true
branch: update-openroad
commit-message: |
[BOT] Update OpenROAD submodule
steps:
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Update flake.lock
run: nix --extra-experimental-features "nix-command flakes" flake update openroad-abc-src openroad-opensta-src openroad-flake
- name: Create Draft PR
uses: peter-evans/create-pull-request@v7
with:
token: ${{ github.token }}
signoff: true
delete-branch: true
title: 'Update OpenROAD submodule'
body: |
Automated action to update tools/OpenROAD submodule and tighten CI rule checking.
[ci:rules-tighten]
labels: UpdateRules
reviewers: |
vvbandeira
maliberty
draft: true
branch: update-openroad
commit-message: |
[BOT] Update OpenROAD submodule
33 changes: 20 additions & 13 deletions .github/workflows/github-actions-cron-update-yosys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,23 @@ jobs:
echo "::set-output name=has_update::$(git --no-pager diff --name-only ${latesttag}..HEAD)"
git checkout ${latesttag}
- if: "steps.remote-update.outputs.has_update != ''"
name: Create Draft PR
uses: peter-evans/create-pull-request@v6
with:
token: ${{ github.token }}
signoff: true
delete-branch: true
title: 'Update yosys submodule'
reviewers: |
habibayassin
draft: true
branch: update-yosys
commit-message: |
[BOT] Update yosys submodule
steps:
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: Update flake.lock
run: nix --extra-experimental-features "nix-command flakes" flake update yosys-abc-src yosys-cxxopts-src yosys-flake
- name: Create Draft PR
uses: peter-evans/create-pull-request@v6
with:
token: ${{ github.token }}
signoff: true
delete-branch: true
title: 'Update yosys submodule'
reviewers: |
habibayassin
draft: true
branch: update-yosys
commit-message: |
[BOT] Update yosys submodule
104 changes: 80 additions & 24 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

93 changes: 79 additions & 14 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,90 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
openroad = {
type = "git";
url = "https://github.com/The-OpenROAD-Project/OpenROAD";
submodules = true;
rev = "ec1bf1a13902813b722f8341c432cd09714d9e55";
openroad-abc-src = {
url = "git+file:tools/OpenROAD/third-party/abc";
flake = false;
};
yosys = {
type = "git";
url = "https://github.com/The-OpenROAD-Project/yosys";
submodules = true;
rev = "c4b5190229616f7ebf8197f43990b4429de3e420";
openroad-opensta-src = {
url = "git+file:tools/OpenROAD/src/sta";
flake = false;
};
openroad-flake = {
url = "git+file:tools/OpenROAD";
flake = true;
};
yosys-abc-src = {
url = "git+file:tools/yosys/abc";
flake = false;
};
yosys-cxxopts-src = {
url = "git+file:tools/yosys/libs/cxxopts";
flake = false;
};
yosys-flake = {
url = "git+file:tools/yosys";
flake = true;
};
};
outputs = { self, nixpkgs, flake-utils, openroad, yosys }: flake-utils.lib.eachDefaultSystem (
outputs = {
self,
nixpkgs,
flake-utils,
openroad-abc-src,
openroad-opensta-src,
openroad-flake,
yosys-abc-src,
yosys-cxxopts-src,
yosys-flake,
}: flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
openroad = (openroad-flake.packages.${system}.default.overrideAttrs (previousAttrs: {
prePatch = builtins.concatStringsSep "\n" [
(''
cp -r --preserve=mode ${openroad-opensta-src} src/sta
chmod -R +w src/sta
cp -r --preserve=mode ${openroad-abc-src} third-party/abc
chmod -R +w third-party/abc
'')
(previousAttrs.prePatch or "")
];
}));
yosys-abc = pkgs.stdenv.mkDerivation {
name = "yosys-abc";
src = "${yosys-abc-src}";
nativeBuildInputs = [ pkgs.cmake ];
buildInputs = [ pkgs.readline ];
installPhase = ''
runHook preInstall
install -Dm755 'abc' "$out/bin/abc"
install -Dm444 'libabc.a' "$out/lib/libabc.a"
runHook postInstall
'';
buildPhase = ''
make ABC_USE_PIC=1 abc libabc.a
'';
};
yosys = (yosys-flake.packages.${system}.default.overrideAttrs (previousAttrs: {
prePatch = builtins.concatStringsSep "\n" [
(''
cp -r --preserve=mode ${yosys-cxxopts-src} libs/cxxopts
chmod -R +w libs/cxxopts
'')
(previousAttrs.prePatch or "")
];
installPhase = ''
make install PREFIX=$out ABCEXTERNAL=yosys-abc
ln -s ${yosys-abc}/bin/abc $out/bin/yosys-abc
'';
}));
in {
devShells.default = pkgs.mkShell {
buildInputs = [
openroad.packages.${system}.default
yosys.packages.${system}.default
openroad
yosys-abc
yosys
pkgs.time
pkgs.klayout
pkgs.verilator
Expand All @@ -37,6 +99,9 @@
pkgs.python3Packages.yamlfix
];
};
packages.openroad = openroad;
packages.yosys-abc = yosys-abc;
packages.yosys = yosys;
}
);
}