nix-ros-overlay/release.nix

53 lines
1.5 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,
system ? builtins.currentSystem,
toplevelOnly ? false,
2024-10-25 08:51:41 +02:00
}:
2019-12-07 17:07:25 -05:00
let
pkgs = import nix-ros-overlay { inherit nixpkgs system; };
2024-10-25 08:51:41 +02:00
inherit (pkgs.lib) isDerivation;
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; })
2024-10-25 08:51:41 +02:00
(readDir ./examples);
};
2024-10-25 08:51:41 +02:00
in
if toplevelOnly
then toplevelPackages
else if distro == null
2024-10-25 08:51:41 +02:00
then releasePackages
else releasePackages.rosPackages.${distro}