2020-06-17 11:06:40 +00:00
|
|
|
{ crateName ? "veloren-voxygen",
|
|
|
|
# `crate2nix` doesn't support profiles in `Cargo.toml`, so default to release. Otherwise bad performance (non-release is built with opt level 0)
|
2020-07-16 13:40:39 +00:00
|
|
|
release ? true, nixpkgs ? <nixpkgs>, system ? builtins.currentSystem
|
|
|
|
, sources ? import ./sources.nix { inherit system; } }:
|
2020-06-17 11:06:40 +00:00
|
|
|
|
|
|
|
let
|
2020-07-16 13:40:39 +00:00
|
|
|
gitHash =
|
|
|
|
# Check if git-lfs is working.
|
2020-06-17 11:06:40 +00:00
|
|
|
if builtins.pathExists ../assets/voxygen/background/bg_main.png then
|
2020-07-16 13:40:39 +00:00
|
|
|
builtins.readFile (pkgs.runCommand "getGitHash" { } ''
|
|
|
|
cd ${
|
|
|
|
# Only copy the `.git` directory to nix store, anything else is a waste.
|
|
|
|
builtins.path {
|
|
|
|
path = ../.git;
|
|
|
|
# Nix store path names don't accept names that start with a dot.
|
|
|
|
name = "git";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
${pkgs.git}/bin/git log -n 1 --pretty=format:%h/%cd --date=format:%Y-%m-%d-%H:%M --abbrev=8 > $out
|
|
|
|
'')
|
2020-06-17 11:06:40 +00:00
|
|
|
else
|
|
|
|
abort ''
|
|
|
|
Git Large File Storage (git-lfs) has not been set up correctly.
|
|
|
|
Most common reasons:
|
|
|
|
- git-lfs was not installed before cloning this repository
|
|
|
|
- this repository was not cloned from the primary gitlab mirror.
|
|
|
|
- The github mirror does not support lfs.
|
|
|
|
See the book at https://book.veloren.net/ for details.
|
|
|
|
'';
|
|
|
|
|
2020-07-16 13:40:39 +00:00
|
|
|
pkgs = import ./nixpkgs.nix { inherit sources nixpkgs system; };
|
2020-06-17 11:06:40 +00:00
|
|
|
|
|
|
|
veloren = with pkgs;
|
|
|
|
callPackage ./Cargo.nix {
|
|
|
|
defaultCrateOverrides = defaultCrateOverrides // {
|
2020-07-16 13:40:39 +00:00
|
|
|
libudev-sys = _: { buildInputs = [ pkg-config libudev ]; };
|
|
|
|
alsa-sys = _: { buildInputs = [ pkg-config alsaLib ]; };
|
|
|
|
veloren-common = _: { NIX_GIT_HASH = gitHash; };
|
|
|
|
veloren-network = _: { buildInputs = [ pkg-config openssl ]; };
|
2020-08-18 14:51:25 +00:00
|
|
|
veloren-voxygen = _: {
|
|
|
|
buildInputs = [ atk cairo glib gtk3 pango ];
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/veloren-voxygen --set LD_LIBRARY_PATH ${xorg.libX11}/lib
|
|
|
|
'';
|
|
|
|
};
|
2020-06-17 11:06:40 +00:00
|
|
|
};
|
2020-07-16 13:40:39 +00:00
|
|
|
inherit release pkgs nixpkgs;
|
2020-06-17 11:06:40 +00:00
|
|
|
};
|
|
|
|
in veloren.workspaceMembers."${crateName}".build
|