mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-18 10:04:08 +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" ```
80 lines
1.8 KiB
Nix
80 lines
1.8 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitLab
|
|
, cargo
|
|
, desktop-file-utils
|
|
, meson
|
|
, ninja
|
|
, pkg-config
|
|
, rustPlatform
|
|
, rustc
|
|
, wrapGAppsHook4
|
|
, cairo
|
|
, gdk-pixbuf
|
|
, glib
|
|
, gtk4
|
|
, libadwaita
|
|
, pango
|
|
, gettext
|
|
, darwin
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "diebahn";
|
|
version = "2.7.0";
|
|
|
|
src = fetchFromGitLab {
|
|
owner = "schmiddi-on-mobile";
|
|
repo = "railway";
|
|
rev = version;
|
|
hash = "sha256-ps55DiAsetmdcItZKcfyYDD0q0w1Tkf/U48UR/zQx1g=";
|
|
};
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
name = "${pname}-${src}";
|
|
inherit src;
|
|
hash = "sha256-StJxWasUMj9kh9rLs4LFI3XaZ1Z5pvFBjEjtp79WZjg=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
cargo
|
|
desktop-file-utils
|
|
meson
|
|
ninja
|
|
pkg-config
|
|
rustPlatform.cargoSetupHook
|
|
rustc
|
|
wrapGAppsHook4
|
|
];
|
|
|
|
buildInputs = [
|
|
cairo
|
|
gdk-pixbuf
|
|
glib
|
|
gtk4
|
|
libadwaita
|
|
pango
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
|
|
CoreFoundation
|
|
Foundation
|
|
Security
|
|
]);
|
|
|
|
# Darwin needs to link against gettext from nixpkgs instead of the one vendored by gettext-sys
|
|
# because the vendored copy does not build with newer versions of clang.
|
|
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
|
|
GETTEXT_BIN_DIR = "${lib.getBin gettext}/bin";
|
|
GETTEXT_INCLUDE_DIR = "${lib.getDev gettext}/include";
|
|
GETTEXT_LIB_DIR = "${lib.getLib gettext}/lib";
|
|
};
|
|
|
|
meta = {
|
|
changelog = "https://gitlab.com/schmiddi-on-mobile/railway/-/blob/${src.rev}/CHANGELOG.md";
|
|
description = "Travel with all your train information in one place. Also known as Railway";
|
|
homepage = "https://gitlab.com/schmiddi-on-mobile/railway";
|
|
license = lib.licenses.gpl3Plus;
|
|
mainProgram = "diebahn";
|
|
maintainers = with lib.maintainers; [ dotlambda lilacious ];
|
|
};
|
|
}
|