diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml new file mode 100644 index 0000000000..52b45d9f09 --- /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/flake.lock b/flake.lock new file mode 100644 index 0000000000..5a07345891 --- /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 0000000000..215e135081 --- /dev/null +++ b/flake.nix @@ -0,0 +1,47 @@ +{ + description = "Fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives."; + + 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/337942 + 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.pinocchio; + pinocchio = pkgs.python3Packages.pinocchio.overrideAttrs (_: { + src = pkgs.lib.fileset.toSource { + root = ./.; + fileset = pkgs.lib.fileset.unions [ + ./benchmark + ./bindings + ./CMakeLists.txt + ./doc + ./examples + ./include + ./models + ./package.xml + ./sources.cmake + ./src + ./unittest + ./utils + ]; + }; + }); + }; + }; + }; +}