| # SPDX-FileCopyrightText: 2024 Clicks Codes |
| # |
| # SPDX-License-Identifier: GPL-3.0-only |
| |
| { |
| lib, |
| inputs, |
| ... |
| }: { |
| checks = pkgs: { |
| nix-unit = pkgs.stdenv.mkDerivation { |
| name = "run nix-unit"; |
| src = ./../..; |
| buildPhase = let |
| getSubInputs = prefix: inputs: lib.trivial.pipe inputs [ |
| (lib.attrsets.mapAttrsToList (name: value: [ |
| "--override-input ${prefix}${name} ${value.outPath}" |
| (if value ? inputs |
| then getSubInputs "${prefix}${name}/" value.inputs |
| else []) |
| ])) |
| lib.lists.flatten |
| (builtins.concatStringsSep " ") |
| ]; |
| inputPathArgs = getSubInputs "" inputs; |
| in '' |
| export HOME="$(realpath .)" |
| ${pkgs.lib.getExe pkgs.nix-unit} \ |
| --eval-store $HOME \ |
| --flake \ |
| --option extra-experimental-features flakes \ |
| --show-trace \ |
| ${inputPathArgs} \ |
| .#specs.${pkgs.system} |
| touch $out |
| ''; |
| }; |
| }; |
| } |