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