nixpkgs/pkgs/by-name/bu/bup/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

89 lines
1.7 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
makeWrapper,
perl,
pandoc,
python3,
git,
par2Support ? true,
par2cmdline ? null,
}:
assert par2Support -> par2cmdline != null;
let
version = "0.33.4";
pythonDeps =
with python3.pkgs;
[
setuptools
tornado
]
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
pyxattr
pylibacl
fuse
];
in
stdenv.mkDerivation {
pname = "bup";
inherit version;
src = fetchFromGitHub {
repo = "bup";
owner = "bup";
rev = version;
hash = "sha256-9rWzHONcu4W/JcnDUGPbuGksroODbhdL6bNF+3Dd2ag=";
};
buildInputs = [
git
python3
];
nativeBuildInputs = [
pandoc
perl
makeWrapper
];
postPatch = "patchShebangs .";
dontAddPrefix = true;
makeFlags = [
"MANDIR=$(out)/share/man"
"DOCDIR=$(out)/share/doc/bup"
"BINDIR=$(out)/bin"
"LIBDIR=$(out)/lib/bup"
];
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang
"-Wno-error=implicit-function-declaration -Wno-error=implicit-int";
postInstall = ''
wrapProgram $out/bin/bup \
--prefix PATH : ${lib.makeBinPath [ git par2cmdline ]} \
--prefix NIX_PYTHONPATH : ${lib.makeSearchPathOutput "lib" python3.sitePackages pythonDeps}
'';
meta = with lib; {
homepage = "https://github.com/bup/bup";
description = "Efficient file backup system based on the git packfile format";
mainProgram = "bup";
license = licenses.gpl2Plus;
longDescription = ''
Highly efficient file backup system based on the git packfile format.
Capable of doing *fast* incremental backups of virtual machine images.
'';
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ rnhmjoj ];
};
}