-
Notifications
You must be signed in to change notification settings - Fork 893
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add nix flake and lock file. Add nix build step. Pending nix flake up…
…date step
- Loading branch information
1 parent
5fa609b
commit bee2ad4
Showing
3 changed files
with
159 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,33 @@ | ||
name: Nix Flake actions | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
jobs: | ||
nix-matrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v24 | ||
- id: set-matrix | ||
name: Generate Nix Matrix | ||
run: | | ||
set -Eeu | ||
matrix="$(nix eval --json '.#githubActions.matrix')" | ||
echo "matrix=$matrix" >> "$GITHUB_OUTPUT" | ||
nix-build: | ||
needs: nix-matrix | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v24 | ||
- run: nix build -L ".#${{ matrix.attr }}" |
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,44 @@ | ||
{ | ||
description = "A nix flake for the Yosys synthesis suite"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
nix-github-actions.url = "github:nix-community/nix-github-actions"; | ||
nix-github-actions.inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils, nix-github-actions }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
}; | ||
customYosys = pkgs.clangStdenv.mkDerivation { | ||
name = "yosys"; | ||
src = ./. ; | ||
buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git ]; | ||
checkInputs = with pkgs; [ gtest ]; | ||
propagatedBuildInputs = with pkgs; [ abc-verifier ]; | ||
preConfigure = "make config-clang"; | ||
checkTarget = "test"; | ||
installPhase = '' | ||
make install PREFIX=$out | ||
''; | ||
meta = with pkgs.lib; { | ||
description = "Yosys Open SYnthesis Suite"; | ||
homepage = "https://yosyshq.net/yosys/"; | ||
license = licenses.isc; | ||
maintainers = with maintainers; [ ]; | ||
}; | ||
}; | ||
in { | ||
packages.default = customYosys; | ||
defaultPackage = customYosys; | ||
devShell = pkgs.mkShell { | ||
buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git gtest abc-verifier ]; | ||
}; | ||
githubActions = nix-github-actions.lib.mkGithubMatrix { checks = self.packages; }; | ||
} | ||
); | ||
} |