mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-09 06:23:36 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
87 lines
1.9 KiB
Nix
87 lines
1.9 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
cmake,
|
|
curl,
|
|
fetchFromGitHub,
|
|
libarchive,
|
|
nix-update-script,
|
|
pkg-config,
|
|
qt5,
|
|
testers,
|
|
util-linux,
|
|
xz,
|
|
enableTelemetry ? false,
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "rpi-imager";
|
|
version = "1.8.5";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "raspberrypi";
|
|
repo = "rpi-imager";
|
|
rev = "refs/tags/v${finalAttrs.version}";
|
|
hash = "sha256-JrotKMyAgQO3Y5RsFAar9N5/wDpWiBcy8RfvBWDiJMs=";
|
|
};
|
|
|
|
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 ];
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
pkg-config
|
|
qt5.wrapQtAppsHook
|
|
util-linux
|
|
];
|
|
|
|
buildInputs =
|
|
[
|
|
curl
|
|
libarchive
|
|
qt5.qtbase
|
|
qt5.qtdeclarative
|
|
qt5.qtgraphicaleffects
|
|
qt5.qtquickcontrols2
|
|
qt5.qtsvg
|
|
qt5.qttools
|
|
xz
|
|
]
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
qt5.qtwayland
|
|
];
|
|
|
|
# Disable telemetry and update check.
|
|
cmakeFlags = lib.optionals (!enableTelemetry) [
|
|
"-DENABLE_CHECK_VERSION=OFF"
|
|
"-DENABLE_TELEMETRY=OFF"
|
|
];
|
|
|
|
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://github.com/raspberrypi/rpi-imager/";
|
|
changelog = "https://github.com/raspberrypi/rpi-imager/releases/tag/v${finalAttrs.version}";
|
|
license = licenses.asl20;
|
|
mainProgram = "rpi-imager";
|
|
maintainers = with maintainers; [
|
|
ymarkus
|
|
anthonyroussel
|
|
];
|
|
platforms = platforms.all;
|
|
# does not build on darwin
|
|
broken = stdenv.hostPlatform.isDarwin;
|
|
};
|
|
})
|