nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, lib, fetchgit, flex, bison, pkg-config, which
2, pythonSupport ? false, python ? null, swig, libyaml
3}:
4
5stdenv.mkDerivation rec {
6 pname = "dtc";
7 version = "1.6.1";
8
9 src = fetchgit {
10 url = "https://git.kernel.org/pub/scm/utils/dtc/dtc.git";
11 rev = "refs/tags/v${version}";
12 sha256 = "sha256-gx9LG3U9etWhPxm7Ox7rOu9X5272qGeHqZtOe68zFs4=";
13 };
14
15 buildInputs = [ libyaml ];
16 nativeBuildInputs = [ flex bison pkg-config which ] ++ lib.optionals pythonSupport [ python swig ];
17
18 postPatch = ''
19 patchShebangs pylibfdt/
20 '';
21
22 makeFlags = [ "PYTHON=python" ];
23 installFlags = [ "INSTALL=install" "PREFIX=$(out)" "SETUP_PREFIX=$(out)" ];
24
25 # Checks are broken on aarch64 darwin
26 # https://github.com/NixOS/nixpkgs/pull/118700#issuecomment-885892436
27 doCheck = !stdenv.isDarwin;
28
29 meta = with lib; {
30 description = "Device Tree Compiler";
31 homepage = "https://git.kernel.org/cgit/utils/dtc/dtc.git";
32 license = licenses.gpl2Plus; # dtc itself is GPLv2, libfdt is dual GPL/BSD
33 maintainers = [ maintainers.dezgeg ];
34 platforms = platforms.unix;
35 };
36}