Skip to content

Commit eeb00de

Browse files
committed
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
1 parent d768cd5 commit eeb00de

File tree

2 files changed

+19
-26
lines changed

2 files changed

+19
-26
lines changed

pkgs/tools/system/pdisk/default.nix renamed to pkgs/by-name/pd/pdisk/package.nix

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@
55
fetchpatch,
66
installShellFiles,
77
libbsd,
8-
CoreFoundation,
9-
IOKit,
108
}:
119

12-
stdenv.mkDerivation rec {
10+
stdenv.mkDerivation (finalAttrs: {
1311
pname = "pdisk";
1412
version = "0.9";
1513

1614
src = fetchFromGitHub {
1715
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}";
2018
hash = "sha256-+gBgnk/1juEHE0nXaz7laUaH7sxrX5SzsLGr0PHsdHs=";
2119
};
2220

@@ -46,25 +44,22 @@ stdenv.mkDerivation rec {
4644
postPatch =
4745
''
4846
substituteInPlace makefile \
49-
--replace 'cc' '${stdenv.cc.targetPrefix}cc'
47+
--replace-fail 'cc' '${stdenv.cc.targetPrefix}cc'
5048
''
5149
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
5250
substituteInPlace makefile \
53-
--replace '-lbsd' '-framework CoreFoundation -framework IOKit'
51+
--replace-fail '-lbsd' '-framework CoreFoundation -framework IOKit'
5452
'';
5553

54+
strictDeps = true;
55+
5656
nativeBuildInputs = [
5757
installShellFiles
5858
];
5959

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+
];
6863

6964
env.NIX_CFLAGS_COMPILE = "-D_GNU_SOURCE";
7065

@@ -73,23 +68,25 @@ stdenv.mkDerivation rec {
7368
installPhase = ''
7469
runHook preInstall
7570
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
7874
7975
installManPage pdisk.8
8076
install -Dm644 pdisk.html $out/share/doc/pdisk/pdisk.html
8177
8278
runHook postInstall
8379
'';
8480

85-
meta = with lib; {
81+
meta = {
8682
description = "Low-level Apple partition table editor for Linux, OSS Apple version";
8783
homepage = "https://github.com/apple-oss-distributions/pdisk";
88-
license = with licenses; [
84+
license = with lib.licenses; [
8985
hpnd # original license statements seems to match this (in files that are shared with mac-fdisk)
9086
apple-psl10 # new files
9187
];
92-
maintainers = with maintainers; [ OPNA2608 ];
93-
platforms = platforms.unix;
88+
mainProgram = "pdisk";
89+
maintainers = with lib.maintainers; [ OPNA2608 ];
90+
platforms = lib.platforms.unix;
9491
};
95-
}
92+
})

pkgs/top-level/all-packages.nix

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3574,10 +3574,6 @@ with pkgs;
35743574

35753575
gzip = callPackage ../tools/compression/gzip { };
35763576

3577-
pdisk = callPackage ../tools/system/pdisk {
3578-
inherit (darwin.apple_sdk.frameworks) CoreFoundation IOKit;
3579-
};
3580-
35813577
plplot = callPackage ../development/libraries/plplot {
35823578
inherit (darwin.apple_sdk.frameworks) Cocoa;
35833579
};

0 commit comments

Comments
 (0)