nix: add .desktop file to veloren-voxygen derivation, update deps and other minor stuff

This commit is contained in:
Yusuf Bera Ertan 2020-12-01 00:15:18 +03:00
parent bb1a481d1d
commit eb730f6904
No known key found for this signature in database
GPG Key ID: 1D8F8FAF2294D6EA
4 changed files with 31 additions and 19 deletions

View File

@ -1,3 +1,8 @@
## Important
If you are going to call the derivations with a custom `nixpkgs` argument, make sure that the `nixpkgs` you pass is on at least the same commit or newer than it.
Unexpected errors may pop up if you use an older version. Same goes for the `sources` argument.
### How to use
To enter the development shell (which includes all tools mentioned in this readme + tools you'll need to develop Veloren), run:

View File

@ -67,11 +67,11 @@ let
makeGitCommand "describe --exact-match --tags HEAD || printf ''"
"getGitTag";
# If gitTag has a tag (meaning the commit we are on is a *release*), use it as version
# If not, we just use the prettified hash we have
# If gitTag has a tag (meaning the commit we are on is a *release*), use it as version, else:
# Just use the prettified hash we have, if we don't have it the build fails
version = if gitTag != "" then gitTag else gitHash;
# Sanitize version string since it contains not allowed characters for a Nix store path
# Only used in the package name
# Sanitize version string since it might contain illegal characters for a Nix store path
# Used in the derivation(s) name
sanitizedVersion = pkgs.stdenv.lib.strings.sanitizeDerivationName version;
veloren-assets = pkgs.runCommand "makeAssetsDir" { } ''
@ -79,26 +79,32 @@ let
ln -sf ${../assets} $out/assets
'';
velorenVoxygenDesktopFile = pkgs.makeDesktopItem rec {
name = "veloren-voxygen";
exec = name;
icon = ../assets/voxygen/logo.ico;
comment =
"Official client for Veloren - the open-world, open-source multiplayer voxel RPG";
desktopName = "Voxygen";
genericName = "Veloren Client";
categories = "Game;";
};
veloren-crates = with pkgs;
callPackage ./Cargo.nix {
defaultCrateOverrides = with common;
defaultCrateOverrides // {
libudev-sys = _: {
inherit (crateDeps.libudev-sys) nativeBuildInputs buildInputs;
};
alsa-sys = _: {
inherit (crateDeps.alsa-sys) nativeBuildInputs buildInputs;
};
libudev-sys = _: crateDeps.libudev-sys;
alsa-sys = _: crateDeps.alsa-sys;
veloren-network = _: crateDeps.veloren-network;
veloren-common = _: {
# Disable `git-lfs` check here since we check it ourselves
# We have to include the command output here, otherwise Nix won't run it
DISABLE_GIT_LFS_CHECK = isGitLfsSetup;
# Declare env values here so that `common/build.rs` sees them
NIX_GIT_HASH = gitHash;
NIX_GIT_TAG = gitTag;
};
veloren-network = _: {
inherit (crateDeps.veloren-network) nativeBuildInputs buildInputs;
};
veloren-server-cli = _: {
name = "veloren-server-cli_${sanitizedVersion}";
inherit version;
@ -120,7 +126,8 @@ let
VELOREN_USERDATA_STRATEGY = "system";
inherit (crateDeps.veloren-voxygen) buildInputs;
nativeBuildInputs = crateDeps.veloren-voxygen.nativeBuildInputs
++ [ makeWrapper ];
++ [ makeWrapper copyDesktopItems ];
desktopItems = [ velorenVoxygenDesktopFile ];
postInstall = ''
wrapProgram $out/bin/veloren-voxygen\
--set VELOREN_ASSETS ${veloren-assets}\
@ -131,7 +138,7 @@ let
meta = meta // {
longDescription = ''
${meta.longDescription}
"This package includes the client, Voxygen."
"This package includes the official client, Voxygen."
'';
};
};

View File

@ -16,7 +16,7 @@ let
bundleCrate = writeScriptBin "bundleCrate" ''
#!${stdenv.shell}
${nix-bundle}/bin/nix-bundle "(pkgs.callPackage ./nix/default.nix { }).$1" /bin/$1
${nix-bundle}/bin/nix-bundle "(pkgs.callPackage ./nix/default.nix { cratesToBuild = [ \"$1\" ]; }).$1" /bin/$1
'';
in
with common;

View File

@ -29,10 +29,10 @@
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1121b2259b7d66e8c7c5131d1588a48c80ef9e58",
"sha256": "0w2i4byhfn8c9lq8a97xnix5alfandqkbyvh6lbpr9zrm63lmyip",
"rev": "b6bca3d80619f1565ba0ea635b0d38234e41c6bd",
"sha256": "09d4f6h98rmxnxzm1x07jxgrc81k6mz7fjigq375fkmb41j2kdsi",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/1121b2259b7d66e8c7c5131d1588a48c80ef9e58.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/b6bca3d80619f1565ba0ea635b0d38234e41c6bd.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgsMoz": {