diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml
new file mode 100644
index 0000000..9488350
--- /dev/null
+++ b/.github/workflows/nix.yml
@@ -0,0 +1,20 @@
+name: "Nix CI"
+
+on: [pull_request, push]
+
+jobs:
+  tests:
+    name: "Nix build on ${{ matrix.os }}"
+    runs-on: "${{ matrix.os }}-latest"
+    strategy:
+      matrix:
+        os: [ubuntu]
+    steps:
+      - uses: actions/checkout@v4
+      - uses: DeterminateSystems/nix-installer-action@main
+      - uses: DeterminateSystems/magic-nix-cache-action@main
+      - run: nix --accept-flake-config build -L
+      - run: nix --accept-flake-config run .#cachix push gepetto $(readlink result)
+        if: github.repository_owner == 'humanoid-path-planner'
+        env:
+          CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
diff --git a/cmake b/cmake
index 657b07c..2bea127 160000
--- a/cmake
+++ b/cmake
@@ -1 +1 @@
-Subproject commit 657b07cb721ecbc383d4e76438eb6ec5c421a332
+Subproject commit 2bea127e8113a32f216ae7a7201e36a6e7c56cc2
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..789da51
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,49 @@
+{
+  lib,
+  cmake,
+  jrl-cmakemodules,
+  python3Packages,
+}:
+
+python3Packages.buildPythonPackage {
+  pname = "hpp-environments";
+  version = "5.0.0";
+  pyproject = false;
+
+  src = lib.fileset.toSource {
+    root = ./.;
+    fileset = lib.fileset.unions [
+      ./CMakeLists.txt
+      ./examples
+      ./meshes
+      ./package.xml
+      ./src
+      ./srdf
+      ./texture
+      ./urdf
+    ];
+  };
+
+  strictDeps = true;
+
+  nativeBuildInputs = [ cmake ];
+  propagatedBuildInputs = [
+    jrl-cmakemodules
+    python3Packages.boost
+    python3Packages.eigenpy
+    python3Packages.pinocchio
+    python3Packages.example-robot-data
+  ];
+
+  doCheck = true;
+
+  # TODO: this requires hpp-corbaserver, which depends on hpp-environments…
+  #pythonImportsCheck = [ "hpp.environments" ];
+
+  meta = {
+    description = "Environments and robot descriptions for HPP";
+    homepage = "https://github.com/humanoid-path-planner/hpp-environments";
+    license = lib.licenses.bsd2;
+    maintainers = [ lib.maintainers.nim65s ];
+  };
+}
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..406cf66
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,48 @@
+{
+  "nodes": {
+    "flake-parts": {
+      "inputs": {
+        "nixpkgs-lib": [
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1717285511,
+        "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=",
+        "owner": "hercules-ci",
+        "repo": "flake-parts",
+        "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8",
+        "type": "github"
+      },
+      "original": {
+        "owner": "hercules-ci",
+        "repo": "flake-parts",
+        "type": "github"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1719575122,
+        "narHash": "sha256-1x3SNH6GtWgpHmhxO4pCz6nidxjCAheF0FpSXSjqRrg=",
+        "owner": "nim65s",
+        "repo": "nixpkgs",
+        "rev": "5206f72d0fadec6f15e6130a86c0695ceb5ec92d",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nim65s",
+        "ref": "gepetto",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "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..2845a83
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,37 @@
+{
+  description = "Environments and robot descriptions for HPP";
+
+  nixConfig = {
+    extra-substituters = [ "https://gepetto.cachix.org" ];
+    extra-trusted-public-keys = [ "gepetto.cachix.org-1:toswMl31VewC0jGkN6+gOelO2Yom0SOHzPwJMY2XiDY=" ];
+  };
+
+  inputs = {
+    nixpkgs.url = "github:nim65s/nixpkgs/gepetto";
+    flake-parts = {
+      url = "github:hercules-ci/flake-parts";
+      inputs.nixpkgs-lib.follows = "nixpkgs";
+    };
+  };
+
+  outputs =
+    inputs@{ flake-parts, ... }:
+    flake-parts.lib.mkFlake { inherit inputs; } {
+      imports = [ ];
+      systems = [
+        "x86_64-linux"
+        "aarch64-linux"
+        "aarch64-darwin"
+        "x86_64-darwin"
+      ];
+      perSystem =
+        { self', pkgs, ... }:
+        {
+          packages = {
+            inherit (pkgs) cachix;
+            default = pkgs.callPackage ./. { };
+          };
+          devShells.default = pkgs.mkShell { inputsFrom = [ self'.packages.default ]; };
+        };
+    };
+}
diff --git a/package.xml b/package.xml
index 0849a8f..f4efb0f 100644
--- a/package.xml
+++ b/package.xml
@@ -1,7 +1,7 @@
 <?xml version='1.0'?>
  <package format='2'>
  <name>hpp-environments</name>
- <version>5.0.0</version>
+ <version>5.1.0</version>
  <description>Environments for the humanoid path planner platform. </description>
 
  <maintainer email='hpp@laas.fr'>Joseph Mirabel</maintainer>
diff --git a/pyproject.toml b/pyproject.toml
index f0bb92e..2e5e139 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -14,7 +14,7 @@ dependencies = [
 description = "Environments for the humanoid path planner platform."
 license = "BSD-2-Clause"
 name = "hpp-environments"
-version = "5.0.0"
+version = "5.1.0"
 
 [tool.ruff]
 extend-exclude = ["cmake"]