Circular Packaging framework with nix Flakes, including ROS support
Project description
flakoboros
Circular Packaging framework with nix Flakes, including ROS support
Goal
When one package is defined in a flake, we can by default:
nix build: build the package (and run its tests)nix shell: open a shell with the package ready to be usednix develop: open a shell without the built package, but with everything required to build itnix run: execute the main program from the package
Flakoboros provide the same experience with multiple packages in a flake:
nix build: build all packages (and run their tests)nix shell: open a shell with all packages ready to be usednix develop: open a shell without any of the packages, but with everything required to build them allnix run: execute the main program from all the packages (eg. a python interpreter with all the python modules available)
To do so, the main API is designed around the idea that your packages are distributed in another more-or-less central Nix repository (eg. nixpkgs or nix-ros-overlay),
and you just need my-package.overrideAttrs { src = lib.cleanSource ./. } in the flake of the source.
Circular Packaging ?
That notion of re-using an existing distribution of a package inside its source.
API overview
example for eigenpy:
{
description = "Bindings between Numpy and Eigen using Boost.Python";
inputs.flakoboros.url = "github:gepetto/flakoboros";
outputs =
inputs:
inputs.flakoboros.lib.mkFlakoboros inputs (
{ lib, ... }:
{
pyOverrideAttrs.eigenpy = {
src = lib.cleanSource ./.;
};
}
);
}
If you need access to more data, a callable form is also available (clic here to reveal)
{
pyOverrideAttrs.example-robot-data =
{ pkgs-final, pkgs-prev, drv-final, drv-prev, py-final, py-prev, ... }:
{
src = lib.cleanSource ./.;
cmakeFlags = [ (lib.cmakeBool "BUILD_TESTING" drv-final.doCheck) ];
nativeBuildInputs = drv-prev.nativeBuildinputs ++ [ pkgs-final.ninja ];
dependencies = drv-prev.dependencies ++ [ py-final.rerun-sdk ];
};
}
Behind the scene, this is a shallow wrapper around `flake-parts.lib.mkFlake`, which can be used directly (clic here to reveal)
{
description = "Bindings between Numpy and Eigen using Boost.Python";
inputs = {
flakoboros.url = "github:gepetto/flakoboros";
flake-parts.follows = "flakoboros/flake-parts";
systems.follows = "flakoboros/systems";
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } (
{ lib, ... }:
{
systems = import inputs.systems;
imports = [
inputs.flakoboros.flakeModule
{
flakoboros = {
pyOverrideAttrs.eigenpy = {
src = lib.cleanSource ./.;
};
};
}
];
}
);
}
This will:
- define
overlays.flakoboroswith this override - (if you don't opt-out) instanciate
pkgswith that overlay - inherit this in
packages.${system}.py-eigenpy - define
packages.${system}.defaultas abuildEnvincluding all otherspackages.${system}.*(fornix build&nix shell) - define
devShells.${system}.defaultas amkShellwithinputsFromthe samepackages.${system}.*(fornix develop/nix-direnv)
ROS
If you have ROS packages, the default package and devShell will use a default ROS distribution (eg. rolling), but the same features are available for other distros, with eg.
nix build .#ros-humblenix shell .#ros-jazzynix develop .#ros-kiltednix run .#ros-rolling
Also, standard ROS tools like colcon and ros2cli will be included.
Extend pkgs, aka alternate universes
{
extends.eigen5 = final: { eigen = final.eigen_5; };
pyOverrideAttrs.eigenpy = {
src = lib.cleanSource ./.;
};
};
This will:
- define
pkgs,packages.${system}.py-eigenpyandpackages.${system}.defaultas before - define
pkgs.pkgs-eigen5as anotherpkgsinstance but whereeigenis overriden everywhere byeigen_5 - define
packages.${system}.pkgs-eigen5, equivalent topackages.${system}.defaultbut with eigen 5 - add scoped everything else, eg.
packages.${system}.pkgs-eigen5.py-eigenpy(technicallypackages.${system}.pkgs-eigen5.passthru.py-eigenpy) - define
devShells.${system}.pkgs-eigen5
So in your CI, you can build . and .#pkgs-eigen5 to check all your stack with both eigen 3.4.1 and 5.0.1.
Also, you can either echo 'use flake .' > .envrc or echo 'use flake .#pkgs-eigen5' > .envrc, and follow your usual cmake -B build && cmake --build build workflow.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flakoboros-0.1.0.tar.gz.
File metadata
- Download URL: flakoboros-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.11","id":"zokor","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df2f72e00284e625b097e5da54db17db5358b1b7ca21ef62ce027c9b648c4151
|
|
| MD5 |
cdf7135e2cf2094cc6ceb8a5badfb4b5
|
|
| BLAKE2b-256 |
9a61ecd165d81fe7d722d721ea546b88ead9abb0af1c6a53d8895db984760205
|
File details
Details for the file flakoboros-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flakoboros-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.11","id":"zokor","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf3caf074e21f711650d3bf57c59561b25b50cb5fc871f7bd8ce3bee6a3e472f
|
|
| MD5 |
b36a1f97858f895524a3209c8e30dd1d
|
|
| BLAKE2b-256 |
710f39239ba9f2f646d6add685c12e75a254aabcc93f85e0001107fb49fa2df3
|