-
Notifications
You must be signed in to change notification settings - Fork 895
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4238 from RCoeurjoly/nix
Begin supporting nix flakes build system
- Loading branch information
Showing
5 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,15 @@ | ||
name: "build nix flake" | ||
on: | ||
pull_request: | ||
push: | ||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- uses: cachix/install-nix-action@v26 | ||
with: | ||
install_url: https://releases.nixos.org/nix/nix-2.18.1/install | ||
- run: nix build .?submodules=1 |
This file contains 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,21 @@ | ||
name: update-flake-lock | ||
on: | ||
workflow_dispatch: # allows manual triggering | ||
schedule: | ||
- cron: '0 0 * * 0' # runs weekly on Sunday at 00:00 | ||
|
||
jobs: | ||
lockfile: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@main | ||
- name: Update flake.lock | ||
uses: DeterminateSystems/update-flake-lock@main | ||
with: | ||
pr-title: "Update flake.lock" # Title of PR to be created | ||
pr-labels: | # Labels to be set on the PR | ||
dependencies | ||
automated |
This file contains 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 |
---|---|---|
|
@@ -45,3 +45,4 @@ __pycache__ | |
/tests/unit/bintest/ | ||
/tests/unit/objtest/ | ||
/tests/ystests | ||
/result |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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,48 @@ | ||
{ | ||
description = "A nix flake for the Yosys synthesis suite"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
}; | ||
# TODO: don't override src when ./abc is empty | ||
# which happens when the command used is `nix build` and not `nix build ?submodules=1` | ||
abc-verifier = pkgs.abc-verifier.overrideAttrs(x: y: {src = ./abc;}); | ||
yosys = pkgs.clangStdenv.mkDerivation { | ||
name = "yosys"; | ||
src = ./. ; | ||
buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git pkg-configUpstream ]; | ||
checkInputs = with pkgs; [ gtest ]; | ||
propagatedBuildInputs = [ abc-verifier ]; | ||
preConfigure = "make config-clang"; | ||
checkTarget = "test"; | ||
installPhase = '' | ||
make install PREFIX=$out ABCEXTERNAL=yosys-abc | ||
ln -s ${abc-verifier}/bin/abc $out/bin/yosys-abc | ||
''; | ||
buildPhase = '' | ||
make -j$(nproc) ABCEXTERNAL=yosys-abc | ||
''; | ||
meta = with pkgs.lib; { | ||
description = "Yosys Open SYnthesis Suite"; | ||
homepage = "https://yosyshq.net/yosys/"; | ||
license = licenses.isc; | ||
maintainers = with maintainers; [ ]; | ||
}; | ||
}; | ||
in { | ||
packages.default = yosys; | ||
defaultPackage = yosys; | ||
devShell = pkgs.mkShell { | ||
buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git gtest abc-verifier ]; | ||
}; | ||
} | ||
); | ||
} |