nixpkgs/pkgs/tools/package-management/pkg/default.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

38 lines
975 B
Nix

{ lib, stdenv, fetchFromGitHub, m4, pkg-config, tcl
, bzip2, elfutils, libarchive, libbsd, xz, openssl, zlib
}:
stdenv.mkDerivation (finalAttrs: {
pname = "pkg";
version = "1.21.3";
src = fetchFromGitHub {
owner = "freebsd";
repo = "pkg";
rev = finalAttrs.version;
hash = "sha256-9LWoacjisyaiR0spF5/k5SneIo09UaCHBE1mrewftd8=";
};
setOutputFlags = false;
separateDebugInfo = true;
nativeBuildInputs = [ m4 pkg-config tcl ];
buildInputs = [ bzip2 elfutils libarchive openssl xz zlib ]
++ lib.optional stdenv.hostPlatform.isLinux libbsd;
enableParallelBuilding = true;
preInstall = ''
mkdir -p $out/etc
'';
meta = with lib; {
homepage = "https://github.com/freebsd/pkg";
description = "Package management tool for FreeBSD";
maintainers = with maintainers; [ qyliss ];
platforms = with platforms; darwin ++ freebsd ++ linux ++ netbsd ++ openbsd;
license = licenses.bsd2;
mainProgram = "pkg";
};
})