From 984bf07af1adc91dd84767b8400b1a690a65d4e0 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Thu, 11 Jul 2024 11:33:19 +0200 Subject: [PATCH] Nix --- .github/workflows/nix.yml | 19 +++++++++++++ flake.lock | 57 +++++++++++++++++++++++++++++++++++++++ flake.nix | 42 +++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 .github/workflows/nix.yml create mode 100644 flake.lock create mode 100644 flake.nix 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/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..6ebaad615 --- /dev/null +++ b/flake.nix @@ -0,0 +1,42 @@ +{ + description = "An extension of the Flexible Collision Library"; + + 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/337549 + 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.hpp-fcl; + hpp-fcl = pkgs.python3Packages.hpp-fcl.overrideAttrs (_: { + src = pkgs.lib.fileset.toSource { + root = ./.; + fileset = pkgs.lib.fileset.unions [ + ./CMakeLists.txt + ./doc + ./include + ./package.xml + ./python + ./src + ./test + ]; + }; + }); + }; + }; + }; +}