Skip to content

Commit

Permalink
update flake build & CI
Browse files Browse the repository at this point in the history
  • Loading branch information
foolnotion committed Jun 1, 2024
1 parent d66bbe9 commit 0046817
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
runs-on: ubuntu-latest
if: github.ref_name == 'main'
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27

- name: Build
working-directory: ${{github.workspace}}
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ env:

jobs:
build:
strategy:
matrix:
os: [ macos-11, macos-12, macos-13 ]
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: macos-13
runs-on: ${{ matrix.os }}
if: github.ref_name == 'main'
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27

- name: Build
working-directory: ${{github.workspace}}
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
];
};
stdenv = pkgs.llvmPackages_18.stdenv;
operon = import ./operon.nix { inherit stdenv pkgs; };
operon = import ./operon.nix { inherit stdenv pkgs system; };
in
rec
{
Expand Down
11 changes: 8 additions & 3 deletions operon.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{ stdenv, pkgs }:
stdenv.mkDerivation {
{ stdenv, pkgs, system }:
stdenv.mkDerivation rec {
name = "operon";
src = ./.;

enableShared = true;

cmakePreset = {
"x86_64-linux" = "build-linux";
"aarch64-darwin" = "build-osx";
}."${system}";

cmakeFlags = [
"--preset ${if pkgs.stdenv.hostPlatform.isx86_64 then "build-linux" else "build-osx"}"
"--preset ${cmakePreset}"
"-DUSE_SINGLE_PRECISION=ON"
];
cmakeBuildType = "Release";
Expand Down

0 comments on commit 0046817

Please sign in to comment.