Skip to content

Commit

Permalink
Merge pull request #74 from michaelvanstraten/add-basic-nix-flake
Browse files Browse the repository at this point in the history
Add basic Nix Flake support and CI workflow
  • Loading branch information
TimSiebert1 authored Nov 12, 2024
2 parents 8393ced + f8098ae commit 49a93fb
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/flake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Nix Flake CI

on:
pull_request:
push:
branches: [master]

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

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

- name: Build Flake
run: nix build --print-build-logs
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 49a93fb

Please sign in to comment.