Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ fetchurl, lib, stdenv, libuuid, popt, icu, ncurses, nixosTests }: 2 3stdenv.mkDerivation rec { 4 pname = "gptfdisk"; 5 version = "1.0.9"; 6 7 src = fetchurl { 8 # https://www.rodsbooks.com/gdisk/${name}.tar.gz also works, but the home 9 # page clearly implies a preference for using SourceForge's bandwidth: 10 url = "mirror://sourceforge/gptfdisk/${pname}-${version}.tar.gz"; 11 sha256 = "sha256-2v6tJpP6646Ll4MrI0B/btWzIZvBeE9ILdhVd04tUMI="; 12 }; 13 14 patches = [ 15 # issues with popt 1.19 (from upstream but not yet released): 16 # https://github.com/rpm-software-management/popt/issues/80 17 ./popt-1-19.patch 18 19 # fix UUID generation (from upstream but not yet released): 20 # https://sourceforge.net/p/gptfdisk/code/ci/6a8416cbd12d55f882bb751993b94f72d338d96f/ 21 # https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1853985.html 22 ./uuid.patch 23 ]; 24 25 postPatch = '' 26 patchShebangs gdisk_test.sh 27 '' + lib.optionalString stdenv.isDarwin '' 28 substituteInPlace Makefile.mac --replace \ 29 "-mmacosx-version-min=10.4" "-mmacosx-version-min=10.6" 30 substituteInPlace Makefile.mac --replace \ 31 " -arch i386" "" 32 substituteInPlace Makefile.mac --replace \ 33 "-arch x86_64" "" 34 substituteInPlace Makefile.mac --replace \ 35 "-arch arm64" "" 36 substituteInPlace Makefile.mac --replace \ 37 " -I/opt/local/include -I /usr/local/include -I/opt/local/include" "" 38 substituteInPlace Makefile.mac --replace \ 39 "/usr/local/Cellar/ncurses/6.2/lib/libncurses.dylib" "${ncurses.out}/lib/libncurses.dylib" 40 ''; 41 42 buildPhase = lib.optionalString stdenv.isDarwin "make -f Makefile.mac"; 43 buildInputs = [ libuuid popt icu ncurses ]; 44 45 installPhase = '' 46 mkdir -p $out/sbin 47 mkdir -p $out/share/man/man8 48 for prog in gdisk sgdisk fixparts cgdisk 49 do 50 install -v -m755 $prog $out/sbin 51 install -v -m644 $prog.8 $out/share/man/man8 52 done 53 ''; 54 55 passthru.tests = lib.optionalAttrs stdenv.hostPlatform.isx86 { 56 installer-simpleLabels = nixosTests.installer.simpleLabels; 57 }; 58 59 meta = with lib; { 60 description = "Set of text-mode partitioning tools for Globally Unique Identifier (GUID) Partition Table (GPT) disks"; 61 license = licenses.gpl2; 62 homepage = "https://www.rodsbooks.com/gdisk/"; 63 platforms = platforms.all; 64 maintainers = [ maintainers.ehmry ]; 65 }; 66}