nixpkgs/pkgs/by-name/ru/rustic/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

65 lines
1.6 KiB
Nix

{
lib,
fetchFromGitHub,
rustPlatform,
stdenv,
Security,
SystemConfiguration,
installShellFiles,
nix-update-script,
}:
rustPlatform.buildRustPackage rec {
pname = "rustic";
version = "0.8.1";
src = fetchFromGitHub {
owner = "rustic-rs";
repo = "rustic";
rev = "refs/tags/v${version}";
hash = "sha256-SOXuQIdebzMHyO/r+0bvhZvdc09pNPiCXgYfzMoZUZo=";
};
cargoHash = "sha256-5tXaq/FPC3T+f1p4RtihQGgwAptcO58mOKQhiOpjacc=";
# At the time of writing, upstream defaults to "self-update", "tui", and "webdav".
# "self-update" is a self-updater, which we don't want in nixpkgs.
# With each update we should therefore ensure that we mimic the default features
# as closely as possible.
buildNoDefaultFeatures = true;
buildFeatures = [
"tui"
"webdav"
];
nativeBuildInputs = [ installShellFiles ];
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
Security
SystemConfiguration
];
postInstall = ''
for shell in {ba,fi,z}sh; do
$out/bin/rustic completions $shell > rustic.$shell
done
installShellCompletion rustic.{ba,fi,z}sh
'';
passthru.updateScript = nix-update-script { };
meta = {
homepage = "https://github.com/rustic-rs/rustic";
changelog = "https://github.com/rustic-rs/rustic/blob/${src.rev}/CHANGELOG.md";
description = "fast, encrypted, deduplicated backups powered by pure Rust";
mainProgram = "rustic";
platforms = lib.platforms.linux ++ lib.platforms.darwin;
license = [
lib.licenses.mit
lib.licenses.asl20
];
maintainers = [ lib.maintainers.nobbz ];
};
}