nixpkgs/pkgs/by-name/ai/airshipper/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

125 lines
2.6 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitLab
, openssl
, libGL
, vulkan-loader
, wayland
, wayland-protocols
, libxkbcommon
, libX11
, libXrandr
, libXi
, libXcursor
, udev
, alsa-lib
, stdenv
, libxcb
, bzip2
, cmake
, fontconfig
, freetype
, pkg-config
, makeWrapper
, writeShellScript
, patchelf
}:
let
version = "0.14.0";
# Patch for airshipper to install veloren
patch = let
runtimeLibs = [
udev
alsa-lib
(lib.getLib stdenv.cc.cc)
libxkbcommon
libxcb
libX11
libXcursor
libXrandr
libXi
vulkan-loader
libGL
];
in
writeShellScript "patch" ''
echo "making binaries executable"
chmod +x {veloren-voxygen,veloren-server-cli}
echo "patching dynamic linkers"
${patchelf}/bin/patchelf \
--set-interpreter "${stdenv.cc.bintools.dynamicLinker}" \
veloren-server-cli
${patchelf}/bin/patchelf \
--set-interpreter "${stdenv.cc.bintools.dynamicLinker}" \
--set-rpath "${lib.makeLibraryPath runtimeLibs}" \
veloren-voxygen
'';
in
rustPlatform.buildRustPackage {
pname = "airshipper";
inherit version;
src = fetchFromGitLab {
owner = "Veloren";
repo = "airshipper";
rev = "v${version}";
hash = "sha256-+ZU3WAjmPDAFAevebePcIlYcgSYSJJ3LyvwbTBKGUH4=";
};
cargoHash = "sha256-mwfYCVcOH2zFr76W9ZC4t/LmEwO5P2eGYXRVkwn6Fm4=";
buildInputs = [
fontconfig
openssl
wayland
wayland-protocols
libxkbcommon
libX11
libXrandr
libXi
libXcursor
];
nativeBuildInputs = [ cmake pkg-config makeWrapper ];
RUSTC_BOOTSTRAP = 1; # We need rust unstable features
postInstall = ''
install -Dm444 -t "$out/share/applications" "client/assets/net.veloren.airshipper.desktop"
install -Dm444 "client/assets/net.veloren.airshipper.png" "$out/share/icons/net.veloren.airshipper.png"
'';
postFixup =
let
libPath = lib.makeLibraryPath [
libGL
vulkan-loader
wayland
wayland-protocols
bzip2
fontconfig
freetype
libxkbcommon
libX11
libXrandr
libXi
libXcursor
];
in
''
patchelf --set-rpath "${libPath}" "$out/bin/airshipper"
wrapProgram "$out/bin/airshipper" --set VELOREN_PATCHER "${patch}"
'';
doCheck = false;
cargoBuildFlags = [ "--package" "airshipper" ];
cargoTestFlags = [ "--package" "airshipper" ];
meta = with lib; {
description = "Provides automatic updates for the voxel RPG Veloren";
mainProgram = "airshipper";
homepage = "https://www.veloren.net";
license = licenses.gpl3;
maintainers = with maintainers; [ yusdacra ];
};
}