Unverified Commit 0c578d11 authored by Anthony Roussel's avatar Anthony Roussel
Browse files

rpi-imager: add passthru.tests.version

parent e2e4463a
Loading
Loading
Loading
Loading
+11 −18
Original line number Diff line number Diff line
@@ -14,18 +14,19 @@
, qtquickcontrols2
, qtgraphicaleffects
, xz
, testers
, nix-update-script
, enableTelemetry ? false
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "rpi-imager";
  version = "1.8.1";

  src = fetchFromGitHub {
    owner = "raspberrypi";
    repo = pname;
    rev = "refs/tags/v${version}";
    repo = finalAttrs.pname;
    rev = "refs/tags/v${finalAttrs.version}";
    sha256 = "sha256-drHiZ0eYYvJg6/v3oEozGAbBKm1KLpec+kYZWwpT9yM=";
  };

@@ -54,33 +55,25 @@ stdenv.mkDerivation rec {
    xz
  ];

  sourceRoot = "${src.name}/src";
  sourceRoot = "${finalAttrs.src.name}/src";

  /* By default, the builder checks for JSON support in lsblk by running "lsblk --json",
    but that throws an error, as /sys/dev doesn't exist in the sandbox.
    This patch removes the check. */
  patches = [ ./lsblkCheckFix.patch ];

  doInstallCheck = true;

  installCheckPhase = ''
    runHook preInstallCheck

    # Without this, the tests fail because they cannot create the QT Window
    export QT_QPA_PLATFORM=offscreen
    $out/bin/rpi-imager --version

    runHook postInstallCheck
  '';

  passthru = {
    tests.version = testers.testVersion {
      package = finalAttrs.finalPackage;
      command = "QT_QPA_PLATFORM=offscreen rpi-imager --version";
    };
    updateScript = nix-update-script { };
  };

  meta = with lib; {
    description = "Raspberry Pi Imaging Utility";
    homepage = "https://www.raspberrypi.com/software/";
    changelog = "https://github.com/raspberrypi/rpi-imager/releases/tag/v${version}";
    changelog = "https://github.com/raspberrypi/rpi-imager/releases/tag/v${finalAttrs.version}";
    downloadPage = "https://github.com/raspberrypi/rpi-imager/";
    license = licenses.asl20;
    maintainers = with maintainers; [ ymarkus anthonyroussel ];
@@ -88,4 +81,4 @@ stdenv.mkDerivation rec {
    # does not build on darwin
    broken = stdenv.isDarwin;
  };
}
})