mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-28 00:24:18 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
73 lines
1.6 KiB
Nix
73 lines
1.6 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchurl,
|
|
autoreconfHook,
|
|
enableMail ? false,
|
|
gnused,
|
|
hostname,
|
|
mailutils,
|
|
systemdLibs,
|
|
IOKit,
|
|
ApplicationServices,
|
|
}:
|
|
|
|
let
|
|
dbrev = "5388";
|
|
drivedbBranch = "RELEASE_7_3_DRIVEDB";
|
|
driverdb = fetchurl {
|
|
url = "https://sourceforge.net/p/smartmontools/code/${dbrev}/tree/branches/${drivedbBranch}/smartmontools/drivedb.h?format=raw";
|
|
sha256 = "sha256-0dtLev4JjeHsS259+qOgg19rz4yjkeX4D3ooUgS4RTI=";
|
|
name = "smartmontools-drivedb.h";
|
|
};
|
|
scriptPath = lib.makeBinPath (
|
|
[
|
|
gnused
|
|
hostname
|
|
]
|
|
++ lib.optionals enableMail [ mailutils ]
|
|
);
|
|
|
|
in
|
|
stdenv.mkDerivation rec {
|
|
pname = "smartmontools";
|
|
version = "7.4";
|
|
|
|
src = fetchurl {
|
|
url = "mirror://sourceforge/smartmontools/${pname}-${version}.tar.gz";
|
|
hash = "sha256-6aYfZB/5bKlTGe37F5SM0pfQzTNCc2ssScmdRxb7mT0=";
|
|
};
|
|
|
|
patches = [
|
|
# fixes darwin build
|
|
./smartmontools.patch
|
|
];
|
|
postPatch = ''
|
|
cp -v ${driverdb} drivedb.h
|
|
'';
|
|
|
|
configureFlags = [
|
|
"--with-scriptpath=${scriptPath}"
|
|
# does not work on NixOS
|
|
"--without-update-smart-drivedb"
|
|
];
|
|
|
|
nativeBuildInputs = [ autoreconfHook ];
|
|
buildInputs =
|
|
lib.optionals stdenv.hostPlatform.isLinux [ systemdLibs ]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
IOKit
|
|
ApplicationServices
|
|
];
|
|
enableParallelBuilding = true;
|
|
|
|
meta = with lib; {
|
|
description = "Tools for monitoring the health of hard drives";
|
|
homepage = "https://www.smartmontools.org/";
|
|
license = licenses.gpl2Plus;
|
|
maintainers = with maintainers; [ Frostman ];
|
|
platforms = with platforms; linux ++ darwin;
|
|
mainProgram = "smartctl";
|
|
};
|
|
}
|