nixpkgs/pkgs/by-name/wi/wiringpi/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

89 lines
2.0 KiB
Nix

{
lib,
stdenv,
symlinkJoin,
fetchFromGitHub,
libxcrypt,
}:
let
version = "3.10";
srcAll = fetchFromGitHub {
owner = "WiringPi";
repo = "WiringPi";
rev = version;
sha256 = "sha256-OWR+yo+SnYaMd8J+ku9ettZi+rDHcHlGZCoucCiRkCI=";
};
mkSubProject =
{
subprj, # The only mandatory argument
buildInputs ? [ ],
src ? srcAll,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "wiringpi-${subprj}";
inherit version src;
sourceRoot = "${src.name}/${subprj}";
inherit buildInputs;
# Remove (meant for other OSs) lines from Makefiles
preInstall = ''
sed -i "/chown root/d" Makefile
sed -i "/chmod/d" Makefile
'';
makeFlags = [
"DESTDIR=${placeholder "out"}"
"PREFIX=/."
# On NixOS we don't need to run ldconfig during build:
"LDCONFIG=echo"
];
});
passthru = {
# Helps nix-update and probably nixpkgs-update find the src of this package
# automatically.
src = srcAll;
inherit mkSubProject;
wiringPi = mkSubProject {
subprj = "wiringPi";
buildInputs = [ libxcrypt ];
};
devLib = mkSubProject {
subprj = "devLib";
buildInputs = [ passthru.wiringPi ];
};
wiringPiD = mkSubProject {
subprj = "wiringPiD";
buildInputs = [
libxcrypt
passthru.wiringPi
passthru.devLib
];
};
gpio = mkSubProject {
subprj = "gpio";
buildInputs = [
libxcrypt
passthru.wiringPi
passthru.devLib
];
};
};
in
symlinkJoin {
name = "wiringpi-${version}";
inherit passthru;
paths = [
passthru.wiringPi
passthru.devLib
passthru.wiringPiD
passthru.gpio
];
meta = with lib; {
description = "Gordon's Arduino wiring-like WiringPi Library for the Raspberry Pi (Unofficial Mirror for WiringPi bindings)";
homepage = "https://github.com/WiringPi/WiringPi";
license = licenses.lgpl3Plus;
maintainers = with maintainers; [ doronbehar ];
platforms = platforms.linux;
};
}