Skip to content

Commit cdafef6

Browse files
committed
Add darwin build and dev support.
1 parent 8914928 commit cdafef6

3 files changed

Lines changed: 24 additions & 20 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ env:
1010

1111
jobs:
1212
build:
13-
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macos-latest] # Add macOS to the matrix
16+
runs-on: ${{ matrix.os }}
1417
steps:
1518
- uses: actions/checkout@v4
1619

flake.nix

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,25 +77,25 @@
7777
devShell-for = pkgs:
7878
let
7979
ps = pkgs.haskellPackages;
80+
isLinux = pkgs.stdenv.isLinux;
81+
isDarwin = pkgs.stdenv.isDarwin;
8082
in
81-
ps.shellFor {
82-
packages = ps: with ps; [ arrayfire ];
83-
withHoogle = true;
84-
buildInputs = with pkgs; [ ocl-icd ];
85-
nativeBuildInputs = with pkgs; with ps; [
86-
# Building and testing
87-
cabal-install
88-
doctest
89-
hsc2hs
90-
# hspec-discover
91-
nil
92-
# Formatters
93-
nixpkgs-fmt
94-
];
95-
shellHook = ''
96-
export LD_LIBRARY_PATH="${pkgs.arrayfire}/lib:$LD_LIBRARY_PATH"
97-
'';
98-
};
83+
ps.shellFor {
84+
packages = ps: if isLinux then [ ps.arrayfire ] else [ ];
85+
withHoogle = true;
86+
buildInputs = with pkgs; (if isLinux then [ ocl-icd ] else [ darwin.apple_sdk.frameworks.Security ]);
87+
nativeBuildInputs = with pkgs; with ps; [
88+
# Building and testing
89+
cabal-install
90+
doctest
91+
hsc2hs
92+
# hspec-discover
93+
nil
94+
# Formatters
95+
nixpkgs-fmt
96+
];
97+
shellHook = if isLinux then ''export LD_LIBRARY_PATH="${pkgs.arrayfire}/lib:$LD_LIBRARY_PATH"'' else "";
98+
};
9999

100100
pkgs-for = system: import inputs.nixpkgs {
101101
inherit system;

test/Main.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ instance (A.AFType a, Arbitrary a) => Arbitrary (Array a) where
2020

2121
main :: IO ()
2222
main = do
23-
A.setBackend A.CPU
23+
A.setBackend A.Default
24+
A.info
2425
-- checks (Proxy :: Proxy (A.Array (A.Complex Float)))
2526
-- checks (Proxy :: Proxy (A.Array (A.Complex Double)))
2627
-- checks (Proxy :: Proxy (A.Array Double))

0 commit comments

Comments
 (0)