blob: 9a21b20ef1cff2e97e2237874ce87d8f6c6fa5ab [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 \
Skyler Grey4d6b6a42024-08-05 18:08:19 +000032 --show-trace \
Skyler Greye6a8c712024-06-22 01:41:28 +000033 ${inputPathArgs} \
34 .#specs.${pkgs.system}
35 touch $out
36 '';
37 };
38 };
39}