Skip to content

Commit bee2ad4

Browse files
committed
Add nix flake and lock file. Add nix build step. Pending nix flake update step
1 parent 5fa609b commit bee2ad4

File tree

3 files changed

+159
-0
lines changed

3 files changed

+159
-0
lines changed
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Nix Flake actions
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
- main
9+
10+
jobs:
11+
nix-matrix:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
matrix: ${{ steps.set-matrix.outputs.matrix }}
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: cachix/install-nix-action@v24
18+
- id: set-matrix
19+
name: Generate Nix Matrix
20+
run: |
21+
set -Eeu
22+
matrix="$(nix eval --json '.#githubActions.matrix')"
23+
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
24+
25+
nix-build:
26+
needs: nix-matrix
27+
runs-on: ${{ matrix.os }}
28+
strategy:
29+
matrix: ${{fromJSON(needs.nix-matrix.outputs.matrix)}}
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: cachix/install-nix-action@v24
33+
- run: nix build -L ".#${{ matrix.attr }}"

flake.lock

+82
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
description = "A nix flake for the Yosys synthesis suite";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
nix-github-actions.url = "github:nix-community/nix-github-actions";
8+
nix-github-actions.inputs.nixpkgs.follows = "nixpkgs";
9+
};
10+
11+
outputs = { self, nixpkgs, flake-utils, nix-github-actions }:
12+
flake-utils.lib.eachDefaultSystem (system:
13+
let
14+
pkgs = import nixpkgs {
15+
inherit system;
16+
};
17+
customYosys = pkgs.clangStdenv.mkDerivation {
18+
name = "yosys";
19+
src = ./. ;
20+
buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git ];
21+
checkInputs = with pkgs; [ gtest ];
22+
propagatedBuildInputs = with pkgs; [ abc-verifier ];
23+
preConfigure = "make config-clang";
24+
checkTarget = "test";
25+
installPhase = ''
26+
make install PREFIX=$out
27+
'';
28+
meta = with pkgs.lib; {
29+
description = "Yosys Open SYnthesis Suite";
30+
homepage = "https://yosyshq.net/yosys/";
31+
license = licenses.isc;
32+
maintainers = with maintainers; [ ];
33+
};
34+
};
35+
in {
36+
packages.default = customYosys;
37+
defaultPackage = customYosys;
38+
devShell = pkgs.mkShell {
39+
buildInputs = with pkgs; [ clang bison flex libffi tcl readline python3 llvmPackages.libcxxClang zlib git gtest abc-verifier ];
40+
};
41+
githubActions = nix-github-actions.lib.mkGithubMatrix { checks = self.packages; };
42+
}
43+
);
44+
}

0 commit comments

Comments
 (0)