mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Revert "Merge branch 'revert-441acd3e' into 'master'"
This reverts commitf170da4da6
, reversing changes made toaa7569061b
.
This commit is contained in:
parent
f170da4da6
commit
58e74a26cd
@ -115,10 +115,6 @@ systems = ["x86_64-linux"]
|
|||||||
name = "veloren-nix"
|
name = "veloren-nix"
|
||||||
key = "veloren-nix.cachix.org-1:zokfKJqVsNV6kI/oJdLF6TYBdNPYGSb+diMVQPn/5Rc="
|
key = "veloren-nix.cachix.org-1:zokfKJqVsNV6kI/oJdLF6TYBdNPYGSb+diMVQPn/5Rc="
|
||||||
|
|
||||||
[workspace.metadata.nix.crateOverride.veloren-network]
|
|
||||||
buildInputs = ["openssl"]
|
|
||||||
nativeBuildInputs = ["pkg-config"]
|
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
vek = { git = "https://github.com/yoanlcq/vek.git", rev = "84d5cb65841d46599a986c5477341bea4456be26" }
|
vek = { git = "https://github.com/yoanlcq/vek.git", rev = "84d5cb65841d46599a986c5477341bea4456be26" }
|
||||||
# patch wgpu so we can use wgpu-profiler crate
|
# patch wgpu so we can use wgpu-profiler crate
|
||||||
|
@ -8,11 +8,21 @@ pub mod projection;
|
|||||||
/// entities
|
/// entities
|
||||||
mod spatial_grid;
|
mod spatial_grid;
|
||||||
|
|
||||||
pub const GIT_VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/githash"));
|
pub const GIT_VERSION_BUILD: &str = include_str!(concat!(env!("OUT_DIR"), "/githash"));
|
||||||
pub const GIT_TAG: &str = include_str!(concat!(env!("OUT_DIR"), "/gittag"));
|
pub const GIT_TAG_BUILD: &str = include_str!(concat!(env!("OUT_DIR"), "/gittag"));
|
||||||
pub const VELOREN_VERSION_STAGE: &str = "Pre-Alpha";
|
pub const VELOREN_VERSION_STAGE: &str = "Pre-Alpha";
|
||||||
|
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
|
pub static ref GIT_VERSION: String = if GIT_VERSION_BUILD.is_empty() {
|
||||||
|
std::env::var("VELOREN_GIT_VERSION").expect("failed to get git version")
|
||||||
|
} else {
|
||||||
|
GIT_VERSION_BUILD.to_string()
|
||||||
|
};
|
||||||
|
pub static ref GIT_TAG: String = if GIT_TAG_BUILD.is_empty() {
|
||||||
|
std::env::var("VELOREN_GIT_TAG").expect("failed to get git tag")
|
||||||
|
} else {
|
||||||
|
GIT_TAG_BUILD.to_string()
|
||||||
|
};
|
||||||
pub static ref GIT_HASH: &'static str = GIT_VERSION.split('/').next().expect("failed to retrieve git_hash!");
|
pub static ref GIT_HASH: &'static str = GIT_VERSION.split('/').next().expect("failed to retrieve git_hash!");
|
||||||
static ref GIT_DATETIME: &'static str = GIT_VERSION.split('/').nth(1).expect("failed to retrieve git_datetime!");
|
static ref GIT_DATETIME: &'static str = GIT_VERSION.split('/').nth(1).expect("failed to retrieve git_datetime!");
|
||||||
pub static ref GIT_DATE: String = GIT_DATETIME.split('-').take(3).collect::<Vec<&str>>().join("-");
|
pub static ref GIT_DATE: String = GIT_DATETIME.split('-').take(3).collect::<Vec<&str>>().join("-");
|
||||||
@ -20,12 +30,12 @@ lazy_static::lazy_static! {
|
|||||||
pub static ref DISPLAY_VERSION: String = if GIT_TAG.is_empty() {
|
pub static ref DISPLAY_VERSION: String = if GIT_TAG.is_empty() {
|
||||||
format!("{}-{}", VELOREN_VERSION_STAGE, *GIT_DATE)
|
format!("{}-{}", VELOREN_VERSION_STAGE, *GIT_DATE)
|
||||||
} else {
|
} else {
|
||||||
format!("{}-{}", VELOREN_VERSION_STAGE, GIT_TAG)
|
format!("{}-{}", VELOREN_VERSION_STAGE, GIT_TAG.as_str())
|
||||||
};
|
};
|
||||||
pub static ref DISPLAY_VERSION_LONG: String = if GIT_TAG.is_empty() {
|
pub static ref DISPLAY_VERSION_LONG: String = if GIT_TAG.is_empty() {
|
||||||
format!("{} ({})", DISPLAY_VERSION.as_str(), *GIT_HASH)
|
format!("{} ({})", DISPLAY_VERSION.as_str(), *GIT_HASH)
|
||||||
} else {
|
} else {
|
||||||
format!("{} ({})", DISPLAY_VERSION.as_str(), GIT_VERSION)
|
format!("{} ({})", DISPLAY_VERSION.as_str(), GIT_VERSION.as_str())
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
107
flake.lock
107
flake.lock
@ -1,12 +1,29 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"devshell": {
|
"crane": {
|
||||||
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1625086391,
|
"lastModified": 1661875961,
|
||||||
"narHash": "sha256-IpNPv1v8s4L3CoxhwcgZIitGpcrnNgnj09X7TA0QV3k=",
|
"narHash": "sha256-f1h/2c6Teeu1ofAHWzrS8TwBPcnN+EEu+z1sRVmMQTk=",
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"rev": "d9f394e4e20e97c2a60c3ad82c2b6ef99be19e24",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"devshell": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1660811669,
|
||||||
|
"narHash": "sha256-V6lmsaLNFz41myppL0yxglta92ijkSvpZ+XVygAh+bU=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "devshell",
|
"repo": "devshell",
|
||||||
"rev": "4b5ac7cf7d9a1cc60b965bb51b59922f2210cbc7",
|
"rev": "c2feacb46ee69949124c835419861143c4016fb5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -15,20 +32,69 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixCargoIntegration": {
|
"dream2nix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"devshell": "devshell",
|
"alejandra": [
|
||||||
"nixpkgs": [
|
"nci",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"rustOverlay": "rustOverlay"
|
"crane": "crane",
|
||||||
|
"devshell": [
|
||||||
|
"nci",
|
||||||
|
"devshell"
|
||||||
|
],
|
||||||
|
"flake-utils-pre-commit": [
|
||||||
|
"nci",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"gomod2nix": [
|
||||||
|
"nci",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"mach-nix": [
|
||||||
|
"nci",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"nci",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"poetry2nix": [
|
||||||
|
"nci",
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"pre-commit-hooks": [
|
||||||
|
"nci",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1627940369,
|
"lastModified": 1662507674,
|
||||||
"narHash": "sha256-KtY837WKsX9B/pIKFDKzN0wl1t3et1JZjMjGa7SAZxI=",
|
"narHash": "sha256-vnXfje4pfTqDEqI837GCT+hNKqzfVwPen++gnLVO9F0=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "dream2nix",
|
||||||
|
"rev": "5ba9061857e3e265538c9785bb56bda2bb8f9bca",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "dream2nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nci": {
|
||||||
|
"inputs": {
|
||||||
|
"devshell": "devshell",
|
||||||
|
"dream2nix": "dream2nix",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"rust-overlay": "rust-overlay"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1662507702,
|
||||||
|
"narHash": "sha256-Q8zfpLNCJublP7t4oHizr5tgsCS4BHFk7Fc7wzWbrzE=",
|
||||||
"owner": "yusdacra",
|
"owner": "yusdacra",
|
||||||
"repo": "nix-cargo-integration",
|
"repo": "nix-cargo-integration",
|
||||||
"rev": "fac8518469e226db4805ff80788979c847b0c322",
|
"rev": "97aa58c683ccf628175118052b3306f40ac21ca0",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -39,34 +105,33 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1627814220,
|
"lastModified": 1662019588,
|
||||||
"narHash": "sha256-P+MDgdZw2CBk9X1ZZaUgHgN+32pTfLFf3XVIBOXirI4=",
|
"narHash": "sha256-oPEjHKGGVbBXqwwL+UjsveJzghWiWV0n9ogo1X6l4cw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "ab5b6828af26215bf2646c31961da5d3749591ef",
|
"rev": "2da64a81275b68fdad38af669afeda43d401e94b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "nixpkgs-unstable",
|
"ref": "nixos-unstable",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixCargoIntegration": "nixCargoIntegration",
|
"nci": "nci"
|
||||||
"nixpkgs": "nixpkgs"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rustOverlay": {
|
"rust-overlay": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1627870491,
|
"lastModified": 1662433378,
|
||||||
"narHash": "sha256-0Myg04QOIcTN1RhgfRNx0i/iCRyVyf/Z6rJxZUmot5k=",
|
"narHash": "sha256-DqMtTtIownl+UIPG1O917IH10UF0Hwql636p22vOJfw=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "71d825269cfaa30605d058bd92381be9af87b0be",
|
"rev": "12aa8ea4381b28b7a3118f96682dc3ffb13fb6b6",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
255
flake.nix
255
flake.nix
@ -1,111 +1,204 @@
|
|||||||
{
|
{
|
||||||
description = "Flake providing Veloren, a multiplayer voxel RPG written in Rust.";
|
description = "Flake providing Veloren, a multiplayer voxel RPG written in Rust.";
|
||||||
|
|
||||||
inputs = {
|
inputs.nci.url = "github:yusdacra/nix-cargo-integration";
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
||||||
nixCargoIntegration = {
|
outputs = inputs: let
|
||||||
url = "github:yusdacra/nix-cargo-integration";
|
lib = inputs.nci.inputs.nixpkgs.lib;
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
ncl = inputs.nci.lib.nci-lib;
|
||||||
};
|
|
||||||
|
git = let
|
||||||
|
sourceInfo = inputs.self.sourceInfo;
|
||||||
|
dateTimeFormat = import ./nix/dateTimeFormat.nix;
|
||||||
|
dateTime = dateTimeFormat sourceInfo.lastModified;
|
||||||
|
shortRev = sourceInfo.shortRev or "dirty";
|
||||||
|
in {
|
||||||
|
prettyRev = shortRev + "/" + dateTime;
|
||||||
|
tag = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs:
|
filteredSource = let
|
||||||
inputs.nixCargoIntegration.lib.makeOutputs {
|
pathsToIgnore = [
|
||||||
|
"flake.nix"
|
||||||
|
"flake.lock"
|
||||||
|
"nix"
|
||||||
|
"assets"
|
||||||
|
"README.md"
|
||||||
|
"CONTRIBUTING.md"
|
||||||
|
"CHANGELOG.md"
|
||||||
|
"CODE_OF_CONDUCT.md"
|
||||||
|
"clippy.toml"
|
||||||
|
".cargo"
|
||||||
|
];
|
||||||
|
ignorePaths = path: type: let
|
||||||
|
split = lib.splitString "/" path;
|
||||||
|
actual = lib.drop 4 split;
|
||||||
|
_path = lib.concatStringsSep "/" actual;
|
||||||
|
in
|
||||||
|
lib.all (n: ! (lib.hasPrefix n _path)) pathsToIgnore;
|
||||||
|
in
|
||||||
|
builtins.path {
|
||||||
|
name = "veloren-source";
|
||||||
|
path = toString ./.;
|
||||||
|
# filter out unnecessary paths
|
||||||
|
filter = ignorePaths;
|
||||||
|
};
|
||||||
|
|
||||||
|
wrapWithAssets = common: _: old: let
|
||||||
|
pkgs = common.pkgs;
|
||||||
|
runtimeLibs = with pkgs; [
|
||||||
|
xorg.libX11
|
||||||
|
xorg.libXi
|
||||||
|
xorg.libxcb
|
||||||
|
xorg.libXcursor
|
||||||
|
xorg.libXrandr
|
||||||
|
libxkbcommon
|
||||||
|
shaderc.lib
|
||||||
|
udev
|
||||||
|
alsa-lib
|
||||||
|
vulkan-loader
|
||||||
|
];
|
||||||
|
assets = pkgs.runCommand "veloren-assets" {} ''
|
||||||
|
mkdir $out
|
||||||
|
ln -sf ${./assets} $out/assets
|
||||||
|
# check if LFS was setup properly
|
||||||
|
checkFile="$out/assets/voxygen/background/bg_main.jpg"
|
||||||
|
result="$(${pkgs.file}/bin/file --mime-type $checkFile)"
|
||||||
|
if [ "$result" = "$checkFile: image/jpeg" ]; then
|
||||||
|
echo "Git LFS seems to be setup properly."
|
||||||
|
else
|
||||||
|
echo "
|
||||||
|
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.
|
||||||
|
Run 'nix-shell -p git git-lfs --run \"git lfs install --local && git lfs fetch && git lfs checkout\"'
|
||||||
|
or 'nix shell nixpkgs#git-lfs nixpkgs#git -c sh -c \"git lfs install --local && git lfs fetch && git lfs checkout\"'.
|
||||||
|
"
|
||||||
|
false
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
wrapped =
|
||||||
|
common.internal.nci-pkgs.utils.wrapDerivation old
|
||||||
|
{nativeBuildInputs = [pkgs.makeWrapper];}
|
||||||
|
''
|
||||||
|
rm -rf $out/bin
|
||||||
|
mkdir $out/bin
|
||||||
|
ln -sf ${old}/bin/* $out/bin/
|
||||||
|
wrapProgram $out/bin/* \
|
||||||
|
${lib.optionalString (old.pname == "veloren-voxygen") "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath runtimeLibs}"} \
|
||||||
|
--set VELOREN_ASSETS ${assets} \
|
||||||
|
--set VELOREN_GIT_VERSION "${git.prettyRev}" \
|
||||||
|
--set VELOREN_GIT_TAG "${git.tag}"
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
wrapped;
|
||||||
|
in
|
||||||
|
inputs.nci.lib.makeOutputs {
|
||||||
root = ./.;
|
root = ./.;
|
||||||
buildPlatform = "crate2nix";
|
|
||||||
defaultOutputs = {
|
defaultOutputs = {
|
||||||
package = "veloren-voxygen";
|
package = "veloren-voxygen";
|
||||||
app = "veloren-voxygen";
|
app = "veloren-voxygen";
|
||||||
};
|
};
|
||||||
|
perCrateOverrides = {
|
||||||
|
veloren-voxygen = {
|
||||||
|
packageMetadata = _: {
|
||||||
|
features = rec {
|
||||||
|
release = ["default-publish"];
|
||||||
|
debug = release;
|
||||||
|
test = release;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
wrapper = wrapWithAssets;
|
||||||
|
};
|
||||||
|
veloren-server-cli.wrapper = wrapWithAssets;
|
||||||
|
};
|
||||||
|
disableVendoredCrateOverrides = true;
|
||||||
overrides = {
|
overrides = {
|
||||||
build = common: prev: {
|
cCompiler = common: common.pkgs.clang;
|
||||||
runTests = !prev.release && prev.runTests;
|
crates = common: prev: let
|
||||||
rootFeatures =
|
|
||||||
if prev.release && common.cargoPkg.name == "veloren-voxygen"
|
|
||||||
then [ "default-publish" ]
|
|
||||||
else prev.rootFeatures;
|
|
||||||
};
|
|
||||||
crateOverrides = common: prev:
|
|
||||||
let
|
|
||||||
pkgs = common.pkgs;
|
pkgs = common.pkgs;
|
||||||
lib = common.lib;
|
|
||||||
|
|
||||||
gitLfsCheckFile = ./assets/voxygen/background/bg_main.jpg;
|
configMoldLinker = ''
|
||||||
utils = import ./nix/utils.nix { inherit pkgs; };
|
touch $CARGO_HOME/config.toml
|
||||||
|
cat >>$CARGO_HOME/config.toml <<EOF
|
||||||
sourceInfo =
|
[target.x86_64-unknown-linux-gnu]
|
||||||
if inputs.self.sourceInfo ? rev
|
linker = "clang"
|
||||||
then inputs.self.sourceInfo // {
|
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
|
||||||
# Tag would have to be set manually for stable releases flake
|
EOF
|
||||||
# because there's currently no way to get the tag via the interface.
|
|
||||||
# tag = v0.9.0;
|
|
||||||
}
|
|
||||||
else (throw "Can't get revision because the git tree is dirty");
|
|
||||||
|
|
||||||
prettyRev = with sourceInfo; builtins.substring 0 8 rev + "/" + utils.dateTimeFormat lastModified;
|
|
||||||
|
|
||||||
tag = with sourceInfo;
|
|
||||||
if sourceInfo ? tag
|
|
||||||
then sourceInfo.tag
|
|
||||||
else "";
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
# Must be in format f4987672/2020-12-10-12:00
|
|
||||||
version =
|
|
||||||
if tag != "" then tag
|
|
||||||
else if prettyRev != "" then prettyRev
|
|
||||||
else throw "Need a tag or pretty revision in order to determine version";
|
|
||||||
|
|
||||||
veloren-assets = pkgs.runCommand "makeAssetsDir" { } ''
|
|
||||||
mkdir $out
|
|
||||||
ln -sf ${./assets} $out/assets
|
|
||||||
'';
|
'';
|
||||||
in
|
in rec {
|
||||||
{
|
|
||||||
# veloren-world = oldAttrs: {
|
|
||||||
# crateBin = lib.filter (bin: bin.name != "chunk_compression_benchmarks") oldAttrs.crateBin;
|
|
||||||
# };
|
|
||||||
veloren-client = oldAttrs: {
|
|
||||||
crateBin = lib.filter (bin: bin.name != "bot") oldAttrs.crateBin;
|
|
||||||
};
|
|
||||||
veloren-voxygen-i18n = oldAttrs: {
|
|
||||||
crateBin = lib.filter (bin: bin.name != "i18n-check") oldAttrs.crateBin;
|
|
||||||
};
|
|
||||||
veloren-common = oldAttrs: {
|
veloren-common = oldAttrs: {
|
||||||
# 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
|
# We have to include the command output here, otherwise Nix won't run it
|
||||||
DISABLE_GIT_LFS_CHECK = utils.isGitLfsSetup gitLfsCheckFile;
|
DISABLE_GIT_LFS_CHECK = true;
|
||||||
# Declare env values here so that `common/build.rs` sees them
|
# We don't add in any information here because otherwise anything
|
||||||
NIX_GIT_HASH = prettyRev;
|
# that depends on common will be recompiled. We will set these in
|
||||||
NIX_GIT_TAG = tag;
|
# our wrapper instead.
|
||||||
crateBin = lib.filter (bin: bin.name != "csv_export" && bin.name != "csv_import" && bin.name != "recipe_graphviz") oldAttrs.crateBin;
|
NIX_GIT_HASH = "";
|
||||||
|
NIX_GIT_TAG = "";
|
||||||
};
|
};
|
||||||
veloren-voxygen = oldAttrs: {
|
veloren-voxygen-deps = oldAttrs: {
|
||||||
|
buildInputs = ncl.addBuildInputs prev (
|
||||||
|
with pkgs; [
|
||||||
|
alsa-lib
|
||||||
|
libxkbcommon
|
||||||
|
udev
|
||||||
|
xorg.libxcb
|
||||||
|
]
|
||||||
|
);
|
||||||
|
nativeBuildInputs =
|
||||||
|
ncl.addNativeBuildInputs prev (with pkgs; [python3 pkg-config mold]);
|
||||||
|
|
||||||
|
SHADERC_LIB_DIR = "${pkgs.shaderc.lib}/lib";
|
||||||
|
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
|
postConfigure = ''
|
||||||
|
${oldAttrs.postConfigure or ""}
|
||||||
|
${configMoldLinker}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
veloren-voxygen = prev:
|
||||||
|
ncl.computeOverridesResult prev [
|
||||||
|
veloren-voxygen-deps
|
||||||
|
(oldAttrs: {
|
||||||
|
src = filteredSource;
|
||||||
|
|
||||||
VELOREN_USERDATA_STRATEGY = "system";
|
VELOREN_USERDATA_STRATEGY = "system";
|
||||||
|
|
||||||
|
dontUseCmakeConfigure = true;
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
substituteInPlace src/audio/soundcache.rs \
|
${oldAttrs.preConfigure or ""}
|
||||||
|
substituteInPlace voxygen/src/audio/soundcache.rs \
|
||||||
--replace \
|
--replace \
|
||||||
"../../../assets/voxygen/audio/null.ogg" \
|
"../../../assets/voxygen/audio/null.ogg" \
|
||||||
"${./assets/voxygen/audio/null.ogg}"
|
"${./assets/voxygen/audio/null.ogg}"
|
||||||
'';
|
'';
|
||||||
postInstall = ''
|
})
|
||||||
if [ -f $out/bin/veloren-voxygen ]; then
|
];
|
||||||
wrapProgram $out/bin/veloren-voxygen \
|
veloren-server-cli-deps = oldAttrs: {
|
||||||
--set VELOREN_ASSETS ${veloren-assets} \
|
nativeBuildInputs = ncl.addNativeBuildInputs prev [pkgs.mold];
|
||||||
--set LD_LIBRARY_PATH ${lib.makeLibraryPath common.runtimeLibs}
|
|
||||||
fi
|
doCheck = false;
|
||||||
|
|
||||||
|
postConfigure = ''
|
||||||
|
${oldAttrs.postConfigure or ""}
|
||||||
|
${configMoldLinker}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
veloren-server-cli = oldAttrs: {
|
veloren-server-cli = prev:
|
||||||
|
ncl.computeOverridesResult prev [
|
||||||
|
veloren-server-cli-deps
|
||||||
|
(oldAttrs: {
|
||||||
|
src = filteredSource;
|
||||||
|
|
||||||
VELOREN_USERDATA_STRATEGY = "system";
|
VELOREN_USERDATA_STRATEGY = "system";
|
||||||
postInstall = ''
|
})
|
||||||
if [ -f $out/bin/veloren-server-cli ]; then
|
];
|
||||||
wrapProgram $out/bin/veloren-server-cli --set VELOREN_ASSETS ${veloren-assets}
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -190,11 +190,10 @@ Modify the relevant `rev` field in `flake.lock` to what you need - you can use `
|
|||||||
|
|
||||||
## Formatting
|
## Formatting
|
||||||
|
|
||||||
Use [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt) to format files.
|
Use [alejandra](https://github.com/kamadorueda/alejandra) to format files.
|
||||||
|
|
||||||
To format every Nix file:
|
To format every Nix file:
|
||||||
```shell
|
```shell
|
||||||
nixpkgs-fmt flake.nix nix/*.nix
|
# From repository root
|
||||||
# or
|
alejandra .
|
||||||
nixpkgs-fmt **/**.nix
|
|
||||||
```
|
```
|
||||||
|
21
nix/dateTimeFormat.nix
Normal file
21
nix/dateTimeFormat.nix
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
t: let
|
||||||
|
rem = x: y: x - x / y * y;
|
||||||
|
days = t / 86400;
|
||||||
|
secondsInDay = rem t 86400;
|
||||||
|
hours = secondsInDay / 3600;
|
||||||
|
minutes = (rem secondsInDay 3600) / 60;
|
||||||
|
|
||||||
|
# Courtesy of https://stackoverflow.com/a/32158604.
|
||||||
|
z = days + 719468;
|
||||||
|
era = (if z >= 0 then z else z - 146096) / 146097;
|
||||||
|
doe = z - era * 146097;
|
||||||
|
yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365;
|
||||||
|
y = yoe + era * 400;
|
||||||
|
doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
|
||||||
|
mp = (5 * doy + 2) / 153;
|
||||||
|
d = doy - (153 * mp + 2) / 5 + 1;
|
||||||
|
m = mp + (if mp < 10 then 3 else -9);
|
||||||
|
y' = y + (if m <= 2 then 1 else 0);
|
||||||
|
|
||||||
|
pad = s: if builtins.stringLength s < 2 then "0" + s else s;
|
||||||
|
in "${toString y'}-${pad (toString m)}-${pad (toString d)}-${pad (toString hours)}:${pad (toString minutes)}"
|
@ -3,4 +3,5 @@
|
|||||||
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
|
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
|
||||||
sha256 = "sha256:0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2";
|
sha256 = "sha256:0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2";
|
||||||
})
|
})
|
||||||
{ src = ../.; }).defaultNix
|
{src = ../.;})
|
||||||
|
.defaultNix
|
||||||
|
@ -3,4 +3,5 @@
|
|||||||
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
|
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
|
||||||
sha256 = "sha256:0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2";
|
sha256 = "sha256:0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2";
|
||||||
})
|
})
|
||||||
{ src = ../.; }).shellNix
|
{src = ../.;})
|
||||||
|
.shellNix
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
{ pkgs }: {
|
|
||||||
isGitLfsSetup = checkFile:
|
|
||||||
let
|
|
||||||
gitLfsCheckOutput =
|
|
||||||
builtins.readFile (pkgs.runCommand "gitLfsCheck" { } ''
|
|
||||||
([ "$(${pkgs.file}/bin/file --mime-type ${checkFile})" = "${checkFile}: image/jpeg" ] && printf "0" || printf "1") > $out
|
|
||||||
'');
|
|
||||||
in
|
|
||||||
if gitLfsCheckOutput == "0" then
|
|
||||||
true
|
|
||||||
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.
|
|
||||||
Run `nix-shell -p git git-lfs --run "git lfs install --local && git lfs fetch && git lfs checkout"`
|
|
||||||
or `nix shell nixpkgs#git-lfs nixpkgs#git -c sh -c "git lfs install --local && git lfs fetch && git lfs checkout"`.
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Format number of seconds in the Unix epoch as %Y-%m-%d-%H:%M.
|
|
||||||
dateTimeFormat = t:
|
|
||||||
let
|
|
||||||
rem = x: y: x - x / y * y;
|
|
||||||
days = t / 86400;
|
|
||||||
secondsInDay = rem t 86400;
|
|
||||||
hours = secondsInDay / 3600;
|
|
||||||
minutes = (rem secondsInDay 3600) / 60;
|
|
||||||
seconds = rem t 60;
|
|
||||||
|
|
||||||
# Courtesy of https://stackoverflow.com/a/32158604.
|
|
||||||
z = days + 719468;
|
|
||||||
era = (if z >= 0 then z else z - 146096) / 146097;
|
|
||||||
doe = z - era * 146097;
|
|
||||||
yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365;
|
|
||||||
y = yoe + era * 400;
|
|
||||||
doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
|
|
||||||
mp = (5 * doy + 2) / 153;
|
|
||||||
d = doy - (153 * mp + 2) / 5 + 1;
|
|
||||||
m = mp + (if mp < 10 then 3 else -9);
|
|
||||||
y' = y + (if m <= 2 then 1 else 0);
|
|
||||||
|
|
||||||
pad = s: if builtins.stringLength s < 2 then "0" + s else s;
|
|
||||||
in
|
|
||||||
"${toString y'}-${pad (toString m)}-${pad (toString d)}-${pad (toString hours)}:${pad (toString minutes)}";
|
|
||||||
}
|
|
@ -18,8 +18,6 @@ It is inspired by games such as Cube World, Legend of Zelda: Breath of the Wild,
|
|||||||
|
|
||||||
This package includes the official client, Voxygen.
|
This package includes the official client, Voxygen.
|
||||||
"""
|
"""
|
||||||
runtimeLibs = ["libGL", "xorg.libX11", "xorg.libXcursor", "xorg.libXrandr", "xorg.libXi", "vulkan-loader", "vulkan-extension-layer"]
|
|
||||||
buildInputs = ["xorg.libxcb"]
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
hot-anim = ["anim/use-dyn-lib"]
|
hot-anim = ["anim/use-dyn-lib"]
|
||||||
|
Loading…
Reference in New Issue
Block a user