diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml new file mode 100644 index 000000000..52b45d9f0 --- /dev/null +++ b/.github/workflows/nix.yml @@ -0,0 +1,19 @@ +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 diff --git a/README.md b/README.md index 1ba508aa5..10c7cd3b2 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,10 @@ Documentation +AUR package +nixpkgs stable 24.05 package +nixpkgs unstable package @@ -52,6 +55,13 @@ If you want to learn more about **Crocoddyl** and its solvers, we suggest readin **Crocoddyl** can be easily installed on various Linux (Ubuntu, Fedora, etc.) and Unix distributions (Mac OS X, BSD, etc.). Below, there are different ways to install Crocoddyl. +### On ArchLinux + +With your favorite AUR helper, eg. paru: +```bash + paru -Syu crocoddyl +``` + ### :dragon: From Just run the following command in the terminal: @@ -60,6 +70,16 @@ Just run the following command in the terminal: ``` Conda installation supports [![conda install](https://anaconda.org/conda-forge/crocoddyl/badges/platforms.svg)](https://anaconda.org/conda-forge/crocoddyl). +### From Nix + +`crocoddyl` & `python3Packages.crocoddyl` are available in [nixpkgs](https://github.com/NixOS/nixpkgs/). + +This repository is also a flake, so you may: +- run a python shell with crocoddyl: `nix run github:loco-3d/crocoddyl` +- use it in your own flake: `crocoddyl.url = "github:loco-3d/crocoddyl";` + +The build cache use by CI and developers is [gepetto.cachix.org](https://app.cachix.org/cache/gepetto) + ### :snake: From Just run the following command in the terminal: diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..5a0734589 --- /dev/null +++ b/flake.lock @@ -0,0 +1,57 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1722555600, + "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1724857063, + "narHash": "sha256-Hr4qs3NQLP6JDUPpItJOztUzsr3IjC9WAWM47ob03GU=", + "owner": "gepetto", + "repo": "nixpkgs", + "rev": "b953c287a7ed9e5d33917ec4c838e1b5de9713e0", + "type": "github" + }, + "original": { + "owner": "gepetto", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1722555339, + "narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..940a0b891 --- /dev/null +++ b/flake.nix @@ -0,0 +1,44 @@ +{ + description = "optimal control library for robot control under contact sequence."; + + inputs = { + flake-parts.url = "github:hercules-ci/flake-parts"; + #nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + # use gepetto fork until https://github.com/NixOS/nixpkgs/pull/324018 + nixpkgs.url = "github:gepetto/nixpkgs"; + }; + + 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.crocoddyl; + crocoddyl = pkgs.python3Packages.crocoddyl.overrideAttrs (_: { + src = pkgs.lib.fileset.toSource { + root = ./.; + fileset = pkgs.lib.fileset.unions [ + ./benchmark + ./bindings + ./CMakeLists.txt + ./doc + ./examples + ./include + ./package.xml + ./src + ./unittest + ]; + }; + }); + }; + }; + }; +}