nix-ros-overlay/release.nix

52 lines
1.7 KiB
Nix
Raw Normal View History

let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
lockedNixpkgs = builtins.fetchTarball {
url = "https://github.com/lopsided98/nixpkgs/archive/${lock.nodes.nixpkgs.locked.rev}.tar.gz";
sha256 = lock.nodes.nixpkgs.locked.narHash;
};
in
2024-10-25 08:51:41 +02:00
{
nixpkgs ? lockedNixpkgs,
nix-ros-overlay ? ./.,
distro ? null, # what to build: null = everything, .* = top or examples, anything else = specific ROS distro
2024-10-25 08:51:41 +02:00
system ? builtins.currentSystem,
}:
2019-12-07 17:07:25 -05:00
let
pkgs = import nix-ros-overlay { inherit nixpkgs system; };
inherit (pkgs.lib) isDerivation filterAttrs;
2024-10-25 08:51:41 +02:00
inherit (builtins) mapAttrs attrNames filter listToAttrs readDir;
cleanupDistro = (_: a: removeAttrs a [
2019-12-07 17:07:25 -05:00
"lib"
"python"
"python3"
"python2"
"pythonPackages"
"python2Packages"
"python3Packages"
"boost"
2024-10-25 08:51:41 +02:00
]);
releaseRosPackages = mapAttrs cleanupDistro pkgs.rosPackages;
overlayAttrNames = attrNames ((import ./overlay.nix) null pkgs);
toplevelPackagesEntries =
map (name: { inherit name; value = pkgs.${name} or null; })
overlayAttrNames;
validToplevelPackageEntries = filter (e: isDerivation e.value)
toplevelPackagesEntries;
toplevelPackages = listToAttrs validToplevelPackageEntries;
releasePackages = toplevelPackages // {
2024-10-25 08:51:41 +02:00
rosPackages = removeAttrs releaseRosPackages [
"lib"
"mkRosDistroOverlay"
2024-10-24 01:43:46 +02:00
"foxy" # No CI for EOL distro
];
2024-10-25 08:51:41 +02:00
examples = mapAttrs
2024-10-24 07:52:18 +02:00
(file: _: import (./examples + "/${file}") { inherit pkgs; })
(filterAttrs (n: v: v == "regular")
(readDir ./examples));
};
2024-10-25 08:51:41 +02:00
in
if distro == ".top" then toplevelPackages
else if distro == ".examples" then releasePackages.examples
else if distro == null then releasePackages
2024-10-25 08:51:41 +02:00
else releasePackages.rosPackages.${distro}