mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-15 16:45:15 +00:00
![Artturin](/assets/img/avatar_default.png)
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" ```
68 lines
1.8 KiB
Nix
68 lines
1.8 KiB
Nix
{ lib
|
|
, rustPlatform
|
|
, fetchFromGitHub
|
|
, nix
|
|
, boost
|
|
, pkg-config
|
|
, stdenv
|
|
, installShellFiles
|
|
, darwin
|
|
, crates ? [ "attic-client" ]
|
|
}:
|
|
rustPlatform.buildRustPackage {
|
|
pname = "attic";
|
|
version = "0-unstable-2024-08-19";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "zhaofengli";
|
|
repo = "attic";
|
|
rev = "acf3c351f8de47c6857f31948ab253f9c7ce2a6f";
|
|
hash = "sha256-jcY81r8PdMQ9dCGhT0YLZzxPj3kQJXyWCmvQLXbR1EI=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
pkg-config
|
|
installShellFiles
|
|
];
|
|
|
|
buildInputs = [
|
|
nix
|
|
boost
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
|
|
SystemConfiguration
|
|
]);
|
|
|
|
cargoLock = {
|
|
lockFile = ./Cargo.lock;
|
|
outputHashes = {
|
|
"nix-base32-0.1.2-alpha.0" = "sha256-wtPWGOamy3+ViEzCxMSwBcoR4HMMD0t8eyLwXfCDFdo=";
|
|
};
|
|
};
|
|
cargoBuildFlags = lib.concatMapStrings (c: "-p ${c} ") crates;
|
|
|
|
ATTIC_DISTRIBUTOR = "nixpkgs";
|
|
NIX_INCLUDE_PATH = "${lib.getDev nix}/include";
|
|
|
|
# Attic interacts with Nix directly and its tests require trusted-user access
|
|
# to nix-daemon to import NARs, which is not possible in the build sandbox.
|
|
doCheck = false;
|
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
if [[ -f $out/bin/attic ]]; then
|
|
installShellCompletion --cmd attic \
|
|
--bash <($out/bin/attic gen-completions bash) \
|
|
--zsh <($out/bin/attic gen-completions zsh) \
|
|
--fish <($out/bin/attic gen-completions fish)
|
|
fi
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Multi-tenant Nix Binary Cache";
|
|
homepage = "https://github.com/zhaofengli/attic";
|
|
license = licenses.asl20;
|
|
maintainers = with maintainers; [ zhaofengli aciceri ];
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
mainProgram = "attic";
|
|
};
|
|
}
|