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 ### How to use
To enter the development shell (which includes all tools mentioned in this readme + tools you'll need to develop Veloren), run: 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 ''" makeGitCommand "describe --exact-match --tags HEAD || printf ''"
"getGitTag"; "getGitTag";
# If gitTag has a tag (meaning the commit we are on is a *release*), use it as version # If gitTag has a tag (meaning the commit we are on is a *release*), use it as version, else:
# If not, we just use the prettified hash we have # Just use the prettified hash we have, if we don't have it the build fails
version = if gitTag != "" then gitTag else gitHash; version = if gitTag != "" then gitTag else gitHash;
# Sanitize version string since it contains not allowed characters for a Nix store path # Sanitize version string since it might contain illegal characters for a Nix store path
# Only used in the package name # Used in the derivation(s) name
sanitizedVersion = pkgs.stdenv.lib.strings.sanitizeDerivationName version; sanitizedVersion = pkgs.stdenv.lib.strings.sanitizeDerivationName version;
veloren-assets = pkgs.runCommand "makeAssetsDir" { } '' veloren-assets = pkgs.runCommand "makeAssetsDir" { } ''
@ -79,26 +79,32 @@ let
ln -sf ${../assets} $out/assets 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; veloren-crates = with pkgs;
callPackage ./Cargo.nix { callPackage ./Cargo.nix {
defaultCrateOverrides = with common; defaultCrateOverrides = with common;
defaultCrateOverrides // { defaultCrateOverrides // {
libudev-sys = _: { libudev-sys = _: crateDeps.libudev-sys;
inherit (crateDeps.libudev-sys) nativeBuildInputs buildInputs; alsa-sys = _: crateDeps.alsa-sys;
}; veloren-network = _: crateDeps.veloren-network;
alsa-sys = _: {
inherit (crateDeps.alsa-sys) nativeBuildInputs buildInputs;
};
veloren-common = _: { veloren-common = _: {
# Disable `git-lfs` check here since we check it ourselves # 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; DISABLE_GIT_LFS_CHECK = isGitLfsSetup;
# Declare env values here so that `common/build.rs` sees them # Declare env values here so that `common/build.rs` sees them
NIX_GIT_HASH = gitHash; NIX_GIT_HASH = gitHash;
NIX_GIT_TAG = gitTag; NIX_GIT_TAG = gitTag;
}; };
veloren-network = _: {
inherit (crateDeps.veloren-network) nativeBuildInputs buildInputs;
};
veloren-server-cli = _: { veloren-server-cli = _: {
name = "veloren-server-cli_${sanitizedVersion}"; name = "veloren-server-cli_${sanitizedVersion}";
inherit version; inherit version;
@ -120,7 +126,8 @@ let
VELOREN_USERDATA_STRATEGY = "system"; VELOREN_USERDATA_STRATEGY = "system";
inherit (crateDeps.veloren-voxygen) buildInputs; inherit (crateDeps.veloren-voxygen) buildInputs;
nativeBuildInputs = crateDeps.veloren-voxygen.nativeBuildInputs nativeBuildInputs = crateDeps.veloren-voxygen.nativeBuildInputs
++ [ makeWrapper ]; ++ [ makeWrapper copyDesktopItems ];
desktopItems = [ velorenVoxygenDesktopFile ];
postInstall = '' postInstall = ''
wrapProgram $out/bin/veloren-voxygen\ wrapProgram $out/bin/veloren-voxygen\
--set VELOREN_ASSETS ${veloren-assets}\ --set VELOREN_ASSETS ${veloren-assets}\
@ -131,7 +138,7 @@ let
meta = meta // { meta = meta // {
longDescription = '' longDescription = ''
${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" '' bundleCrate = writeScriptBin "bundleCrate" ''
#!${stdenv.shell} #!${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 in
with common; with common;

View File

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