blob: 0340be1770029e913ace24a2a94cb44961ae252c [file] [log] [blame]
Skyler Greye6a8c712024-06-22 01:41:28 +00001# SPDX-FileCopyrightText: 2024 Clicks Codes
2#
3# SPDX-License-Identifier: GPL-3.0-only
4
5{
6 lib,
7 inputs,
8 ...
9}: {
10 checks = pkgs: {
11 nix-unit = pkgs.stdenv.mkDerivation {
12 name = "run nix-unit";
13 src = ./../..;
14 buildPhase = let
15 getSubInputs = prefix: inputs: lib.trivial.pipe inputs [
16 (lib.attrsets.mapAttrsToList (name: value: [
17 "--override-input ${prefix}${name} ${value.outPath}"
18 (if value ? inputs
19 then getSubInputs "${prefix}${name}/" value.inputs
20 else [])
21 ]))
22 lib.lists.flatten
23 (builtins.concatStringsSep " ")
24 ];
25 inputPathArgs = getSubInputs "" inputs;
26 in ''
27 export HOME="$(realpath .)"
28 ${pkgs.lib.getExe pkgs.nix-unit} \
29 --eval-store $HOME \
30 --flake \
31 --option extra-experimental-features flakes \
32 ${inputPathArgs} \
33 .#specs.${pkgs.system}
34 touch $out
35 '';
36 };
37 };
38}