{ config, pkgs, lib, ... }: with builtins // lib; let json = pkgs.formats.json {}; cfg = config.build.info; in { options = { info = mkOption { internal = true; type = json.type; default = {}; }; build = { info = mkOption { internal = true; readOnly = true; type = types.package; default = pkgs.writeShellApplication { name = "kobo-info"; runtimeInputs = with pkgs; [ jq kobo-utils ]; text = '' echo "Local information:" echo '${toJSON config.info}' | jq . echo "Remote information:" KOBOPATH="$(kobo-find -f || echo "")" if [[ -z "$KOBOPATH" ]]; then echo "No remote found" exit 0 fi kobo-info --json "$KOBOPATH" | jq . ''; }; }; }; }; config = { info = { device = { inherit (config.device) name affiliate hardware deviceID serialNumber; }; firmware = { inherit (config.firmware) version date; }; }; }; }