mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-11 16:23:26 +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" ```
68 lines
1.7 KiB
Nix
68 lines
1.7 KiB
Nix
{ stdenv
|
|
, lib
|
|
, darwin
|
|
, rustPlatform
|
|
, fetchFromGitHub
|
|
, jq
|
|
, moreutils
|
|
, nix-update-script
|
|
, withCmd ? false
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "kanata";
|
|
version = "1.7.0-prerelease-1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "jtroo";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
sha256 = "sha256-eDeGVmh1gI/DhiP6gxJyGH9G9LNH1NHW0+DNuOPUnBY=";
|
|
};
|
|
|
|
cargoHash = "sha256-Om9Thyr10wc39J6adSWgmXtvjckaEW0z68sWxUqa4wc=";
|
|
|
|
# the dependency native-windows-gui contains both README.md and readme.md,
|
|
# which causes a hash mismatch on systems with a case-insensitive filesystem
|
|
# this removes the readme files and updates cargo's checksum file accordingly
|
|
depsExtraArgs = {
|
|
nativeBuildInputs = [
|
|
jq
|
|
moreutils
|
|
];
|
|
|
|
postBuild = ''
|
|
pushd $name/native-windows-gui
|
|
|
|
rm --force --verbose README.md readme.md
|
|
jq 'del(.files."README.md") | del(.files."readme.md")' \
|
|
.cargo-checksum.json -c \
|
|
| sponge .cargo-checksum.json
|
|
|
|
popd
|
|
'';
|
|
};
|
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.IOKit ];
|
|
|
|
buildFeatures = lib.optional withCmd "cmd";
|
|
|
|
postInstall = ''
|
|
install -Dm 444 assets/kanata-icon.svg $out/share/icons/hicolor/scalable/apps/kanata.svg
|
|
'';
|
|
|
|
passthru = {
|
|
updateScript = nix-update-script { };
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Tool to improve keyboard comfort and usability with advanced customization";
|
|
homepage = "https://github.com/jtroo/kanata";
|
|
license = licenses.lgpl3Only;
|
|
maintainers = with maintainers; [ bmanuel linj ];
|
|
platforms = platforms.unix;
|
|
mainProgram = "kanata";
|
|
broken = stdenv.hostPlatform.isDarwin;
|
|
};
|
|
}
|