nixpkgs/pkgs/by-name/kn/knxd/package.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
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"
```
2024-09-25 00:04:37 +03:00

59 lines
1.4 KiB
Nix

{ lib
, stdenv
, buildPackages
, fetchFromGitHub
, autoreconfHook
, pkg-config
, indent
, perl
, argp-standalone
, fmt_9
, libev
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
, withUsb ? stdenv.hostPlatform.isLinux, libusb1
}:
stdenv.mkDerivation (finalAttrs: {
pname = "knxd";
version = "0.14.61";
src = fetchFromGitHub {
owner = "knxd";
repo = "knxd";
rev = finalAttrs.version;
hash = "sha256-b8svjGaxW8YqonhXewebDUitezKoMcZxcUFGd2EKZQ4=";
};
postPatch = ''
sed -i '2i echo ${finalAttrs.version}; exit' tools/version.sh
sed -i '2i exit' tools/get_libfmt
'';
nativeBuildInputs = [ autoreconfHook pkg-config indent perl ];
buildInputs = [ fmt_9 libev ]
++ lib.optional withSystemd systemd
++ lib.optional withUsb libusb1
++ lib.optional stdenv.hostPlatform.isDarwin argp-standalone;
configureFlags = [
(lib.enableFeature withSystemd "systemd")
(lib.enableFeature withUsb "usb")
];
depsBuildBuild = [ buildPackages.stdenv.cc ];
installFlags = lib.optionals withSystemd [
"systemdsystemunitdir=$(out)/lib/systemd/system"
"systemdsysusersdir=$(out)/lib/sysusers.d"
];
meta = with lib; {
description = "Advanced router/gateway for KNX";
homepage = "https://github.com/knxd/knxd";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ sikmir ];
platforms = platforms.unix;
};
})