From e227fa6ba60797d8c14574fa8d399ec9a636296e Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Fri, 4 Oct 2024 14:11:49 +0200 Subject: [PATCH] nix --- flake.lock | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 27 +++++++++++++++++++++++++ package.nix | 43 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 package.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..13dd32c --- /dev/null +++ b/flake.lock @@ -0,0 +1,58 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1727826117, + "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1727174734, + "narHash": "sha256-xa3TynMF5vaWonmTOg/Ejc1Fmo0GkQnCaVRVkBc3z2I=", + "owner": "gepetto", + "repo": "nixpkgs", + "rev": "0ad139a0e4372abc12320c8c92ee90e0e5e296e1", + "type": "github" + }, + "original": { + "owner": "gepetto", + "ref": "master", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1727825735, + "narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.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 0000000..7316848 --- /dev/null +++ b/flake.nix @@ -0,0 +1,27 @@ +{ + description = "Set of tools to work with robots with bilateral constraints"; + + inputs = { + flake-parts.url = "github:hercules-ci/flake-parts"; + nixpkgs.url = "github:gepetto/nixpkgs/master"; + }; + + 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.toolbox-parallel-robots; + toolbox-parallel-robots = pkgs.python3Packages.toPythonModule (pkgs.callPackage ./package.nix { }); + }; + }; + }; +} diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..1729941 --- /dev/null +++ b/package.nix @@ -0,0 +1,43 @@ +{ + cmake, + lib, + pkg-config, + python3Packages, + stdenv, +}: + +stdenv.mkDerivation rec { + pname = "toolbox-parallel-robots"; + version = "0-unstable-2024-30-09"; + + src = lib.fileset.toSource { + root = ./.; + fileset = lib.fileset.unions [ + ./CMakeLists.txt + ./package.xml + ./toolbox_parallel_robots + ]; + }; + + cmakeFlags = [ + (lib.cmakeBool "BUILD_BENCHMARK" false) + (lib.cmakeBool "BUILD_DOCUMENTATION" false) + (lib.cmakeBool "BUILD_EXAMPLES" false) + (lib.cmakeBool "BUILD_TESTING" false) + (lib.cmakeBool "GENERATE_PYTHON_STUBS" false) + ]; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + propagatedBuildInputs = [ python3Packages.pinocchio ]; + + meta = { + description = "Set of tools to work with robots with bilateral constraints"; + homepage = "https://github.com/gepetto/toolbox-parallel-robots"; + license = lib.licenses.bsd2; + maintainers = with lib.maintainers; [ nim65s ]; + platforms = lib.platforms.unix; + }; +}