mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 00:43:20 +00:00
e0464e4788
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" ```
56 lines
1.5 KiB
Nix
56 lines
1.5 KiB
Nix
{ lib
|
|
, stdenv
|
|
, darwin
|
|
, fetchFromGitHub
|
|
, fetchpatch
|
|
, rustPlatform
|
|
, pkg-config
|
|
, alsa-lib
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "kord";
|
|
version = "0.6.1";
|
|
|
|
# kord depends on nightly features
|
|
RUSTC_BOOTSTRAP = 1;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "twitchax";
|
|
repo = "kord";
|
|
rev = "v${version}";
|
|
sha256 = "sha256-CeMh6yB4fGoxtGLbkQe4OMMvBM0jesyP+8JtU5kCP84=";
|
|
};
|
|
|
|
cargoLock = {
|
|
lockFile = ./Cargo.lock;
|
|
outputHashes = {
|
|
"bincode-2.0.0-rc.2" = "sha256-0BfKKGOi5EVIoF0HvIk0QS2fHUMG3tpsMLe2SkXeZlo=";
|
|
};
|
|
};
|
|
|
|
patches = [
|
|
# Fixes build issues due to refactored Rust compiler feature annotations.
|
|
# Should be removable with the next release after v. 0.6.1.
|
|
(fetchpatch {
|
|
name = "fix-rust-features.patch";
|
|
url = "https://github.com/twitchax/kord/commit/fa9bb979b17d77f54812a915657c3121f76c5d82.patch";
|
|
hash = "sha256-XQu9P7372J2dHWzvpvbPtALS0Bh8EC+J1EyG3qlak2M=";
|
|
excludes = [ "Cargo.*" ];
|
|
})
|
|
];
|
|
|
|
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ pkg-config ]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ rustPlatform.bindgenHook ];
|
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ alsa-lib ]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.AudioUnit ];
|
|
|
|
meta = with lib; {
|
|
description = "Music theory binary and library for Rust";
|
|
homepage = "https://github.com/twitchax/kord";
|
|
maintainers = with maintainers; [ kidsan ];
|
|
license = with licenses; [ mit ];
|
|
};
|
|
}
|