pdisk: Modernise

- Switch to finalAttrs
- Don't use pname in src args
- src.rev -> src.tag
- Use --replace-fail
- Enable strictDeps
- Drop meta-wide "with lib"
- Add meta.mainProgram
- Migrate to pkgs/by-name

OPNA2608 eeb00de3 d768cd5b

+19 -26
+19 -22
pkgs/tools/system/pdisk/default.nix pkgs/by-name/pd/pdisk/package.nix
··· 5 5 fetchpatch, 6 6 installShellFiles, 7 7 libbsd, 8 - CoreFoundation, 9 - IOKit, 10 8 }: 11 9 12 - stdenv.mkDerivation rec { 10 + stdenv.mkDerivation (finalAttrs: { 13 11 pname = "pdisk"; 14 12 version = "0.9"; 15 13 16 14 src = fetchFromGitHub { 17 15 owner = "apple-oss-distributions"; 18 - repo = pname; 19 - rev = "${pname}-${lib.versions.minor version}"; 16 + repo = "pdisk"; 17 + tag = "pdisk-${lib.versions.minor finalAttrs.version}"; 20 18 hash = "sha256-+gBgnk/1juEHE0nXaz7laUaH7sxrX5SzsLGr0PHsdHs="; 21 19 }; 22 20 ··· 46 44 postPatch = 47 45 '' 48 46 substituteInPlace makefile \ 49 - --replace 'cc' '${stdenv.cc.targetPrefix}cc' 47 + --replace-fail 'cc' '${stdenv.cc.targetPrefix}cc' 50 48 '' 51 49 + lib.optionalString stdenv.hostPlatform.isDarwin '' 52 50 substituteInPlace makefile \ 53 - --replace '-lbsd' '-framework CoreFoundation -framework IOKit' 51 + --replace-fail '-lbsd' '-framework CoreFoundation -framework IOKit' 54 52 ''; 55 53 54 + strictDeps = true; 55 + 56 56 nativeBuildInputs = [ 57 57 installShellFiles 58 58 ]; 59 59 60 - buildInputs = 61 - lib.optionals (!stdenv.hostPlatform.isDarwin) [ 62 - libbsd 63 - ] 64 - ++ lib.optionals (stdenv.hostPlatform.isDarwin) [ 65 - CoreFoundation 66 - IOKit 67 - ]; 60 + buildInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [ 61 + libbsd 62 + ]; 68 63 69 64 env.NIX_CFLAGS_COMPILE = "-D_GNU_SOURCE"; 70 65 ··· 73 68 installPhase = '' 74 69 runHook preInstall 75 70 76 - install -Dm755 cvt_pt $out/bin/cvt_pt 77 - install -Dm755 pdisk $out/bin/pdisk 71 + for exe in pdisk cvt_pt; do 72 + install -Dm755 -t $out/bin $exe 73 + done 78 74 79 75 installManPage pdisk.8 80 76 install -Dm644 pdisk.html $out/share/doc/pdisk/pdisk.html ··· 82 78 runHook postInstall 83 79 ''; 84 80 85 - meta = with lib; { 81 + meta = { 86 82 description = "Low-level Apple partition table editor for Linux, OSS Apple version"; 87 83 homepage = "https://github.com/apple-oss-distributions/pdisk"; 88 - license = with licenses; [ 84 + license = with lib.licenses; [ 89 85 hpnd # original license statements seems to match this (in files that are shared with mac-fdisk) 90 86 apple-psl10 # new files 91 87 ]; 92 - maintainers = with maintainers; [ OPNA2608 ]; 93 - platforms = platforms.unix; 88 + mainProgram = "pdisk"; 89 + maintainers = with lib.maintainers; [ OPNA2608 ]; 90 + platforms = lib.platforms.unix; 94 91 }; 95 - } 92 + })
-4
pkgs/top-level/all-packages.nix
··· 3574 3574 3575 3575 gzip = callPackage ../tools/compression/gzip { }; 3576 3576 3577 - pdisk = callPackage ../tools/system/pdisk { 3578 - inherit (darwin.apple_sdk.frameworks) CoreFoundation IOKit; 3579 - }; 3580 - 3581 3577 plplot = callPackage ../development/libraries/plplot { 3582 3578 inherit (darwin.apple_sdk.frameworks) Cocoa; 3583 3579 };