flake.nix: Add "checks" flake output based on release.nix

To make "nix flake check" and similar tools work, we need to allow
setting the system attribute in release.nix explicitly. Without this,
flake jobs in Hydra complain about:

    error: attribute 'currentSystem' missing' in restricted evaluation mode.
This commit is contained in:
Michal Sojka 2024-10-23 08:14:40 +02:00 committed by Ben Wolsieffer
parent 894271ba89
commit ce30af70c7
2 changed files with 5 additions and 2 deletions

View file

@ -39,6 +39,9 @@
path = ./examples/flake;
description = "Basic ROS flake";
};
checks = {
x86_64-linux = import ./release.nix { system = "x86_64-linux"; };
};
};
nixConfig = {

View file

@ -5,7 +5,7 @@ let
sha256 = lock.nodes.nixpkgs.locked.narHash;
};
in
{ nixpkgs ? lockedNixpkgs, nix-ros-overlay ? ./., distro ? null }:
{ nixpkgs ? lockedNixpkgs, nix-ros-overlay ? ./., distro ? null, system ? builtins.currentSystem }:
let
releasePackages = builtins.mapAttrs (_: a: removeAttrs a [
"lib"
@ -16,5 +16,5 @@ let
"python2Packages"
"python3Packages"
"boost"
]) (import nix-ros-overlay { inherit nixpkgs; }).rosPackages;
]) (import nix-ros-overlay { inherit nixpkgs system; }).rosPackages;
in if distro == null then releasePackages else releasePackages.${distro}