Skip to content

Commit

Permalink
Add Nix Flake support and CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelvanstraten committed Nov 11, 2024
1 parent 9a19766 commit 4c4c04c
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/flake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Nix Flake CI

on:
pull_request:
push:
branches: [master]

jobs:
check-and-build:
name: Check and Build Nix Flake
runs-on: ubuntu-latest

strategy:
matrix:
system: [x86_64-linux, aarch64-linux] # Check for multiple systems
fail-fast: false

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-unstable

- name: Check Flake
run: nix flake check --all-systems --system ${{ matrix.system }}

- name: Build Flake
run: nix build .# --system ${{ matrix.system }}

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,6 @@ install_manifest.txt
*.dylib
*.so
*.dll

# Nix build results
result*
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
description = "A Package for Automatic Differentiation of Algorithms Written in C/C++ ";

inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};

outputs =
{ flake-utils, nixpkgs, ... }:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
in
{
packages = rec {
adolc-cmake = pkgs.stdenv.mkDerivation {
name = "adolc";
src = ./.;
nativeBuildInputs = [ pkgs.cmake ];
};

adolc-autotools = adolc-cmake.overrideAttrs (
_: _: {
nativeBuildInputs = [ pkgs.autoreconfHook ];
}
);

default = adolc-cmake;
};
}
);
}

0 comments on commit 4c4c04c

Please sign in to comment.