-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from agimus-project/flake
Nix: initial packaging + CI
- Loading branch information
Showing
4 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: "CI - Nix" | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
nix: | ||
runs-on: "${{ matrix.os }}-latest" | ||
strategy: | ||
matrix: | ||
os: [ubuntu, macos] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: cachix/install-nix-action@v27 | ||
- uses: cachix/cachix-action@v15 | ||
with: | ||
name: gepetto | ||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | ||
- run: nix build -L .#colmpc | ||
- run: nix build -L .#py-colmpc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
lib, | ||
stdenv, | ||
cmake, | ||
crocoddyl, | ||
ipopt, | ||
llvmPackages, | ||
pkg-config, | ||
python3Packages, | ||
pythonSupport ? false, | ||
}: | ||
|
||
stdenv.mkDerivation { | ||
pname = "colmpc"; | ||
version = "0.2.0"; | ||
|
||
src = lib.fileset.toSource { | ||
root = ./.; | ||
fileset = lib.fileset.unions [ | ||
./CMakeLists.txt | ||
./include | ||
./package.xml | ||
./python | ||
./tests | ||
]; | ||
}; | ||
|
||
nativeBuildInputs = [ | ||
cmake | ||
pkg-config | ||
] ++ lib.optional pythonSupport python3Packages.pythonImportsCheckHook; | ||
|
||
buildInputs = lib.optional stdenv.cc.isClang llvmPackages.openmp; | ||
|
||
propagatedBuildInputs = | ||
[ ipopt ] | ||
++ lib.optional pythonSupport python3Packages.crocoddyl | ||
++ lib.optional (!pythonSupport) crocoddyl; | ||
|
||
cmakeFlags = [ | ||
(lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport) | ||
]; | ||
|
||
doCheck = true; | ||
pythonImportsCheck = [ "colmpc" ]; | ||
|
||
meta = { | ||
description = "Collision avoidance for MPC"; | ||
homepage = "https://github.com/agimus-project/colmpc"; | ||
license = lib.licenses.bsd2; | ||
maintainers = with lib.maintainers; [ nim65s ]; | ||
platforms = lib.platforms.unix; | ||
}; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
description = "Collision avoidance for MPC"; | ||
|
||
inputs = { | ||
flake-parts.url = "github:hercules-ci/flake-parts"; | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
}; | ||
|
||
outputs = | ||
inputs: | ||
inputs.flake-parts.lib.mkFlake { inherit inputs; } { | ||
systems = inputs.nixpkgs.lib.systems.flakeExposed; | ||
perSystem = | ||
{ pkgs, self', ... }: | ||
{ | ||
apps.default = { | ||
type = "app"; | ||
program = pkgs.python3.withPackages (_: [ self'.packages.default ]); | ||
}; | ||
devShells.default = pkgs.mkShell { inputsFrom = [ self'.packages.default ]; }; | ||
packages = { | ||
default = self'.packages.py-colmpc; | ||
colmpc = pkgs.callPackage ./. { }; | ||
py-colmpc = pkgs.python3Packages.toPythonModule ( | ||
self'.packages.colmpc.override { pythonSupport = true; } | ||
); | ||
}; | ||
}; | ||
}; | ||
} |