mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fix: update flake
This commit is contained in:
parent
1798cdcffe
commit
dd6c33bab7
100
flake.lock
100
flake.lock
@ -3,11 +3,11 @@
|
||||
"crane": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1661875961,
|
||||
"narHash": "sha256-f1h/2c6Teeu1ofAHWzrS8TwBPcnN+EEu+z1sRVmMQTk=",
|
||||
"lastModified": 1670900067,
|
||||
"narHash": "sha256-VXVa+KBfukhmWizaiGiHRVX/fuk66P8dgSFfkVN4/MY=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "d9f394e4e20e97c2a60c3ad82c2b6ef99be19e24",
|
||||
"rev": "59b31b41a589c0a65e4a1f86b0e5eac68081468b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -19,11 +19,11 @@
|
||||
"devshell": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1660811669,
|
||||
"narHash": "sha256-V6lmsaLNFz41myppL0yxglta92ijkSvpZ+XVygAh+bU=",
|
||||
"lastModified": 1667210711,
|
||||
"narHash": "sha256-IoErjXZAkzYWHEpQqwu/DeRNJGFdR7X2OGbkhMqMrpw=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "c2feacb46ee69949124c835419861143c4016fb5",
|
||||
"rev": "96a9dd12b8a447840cc246e17a47b81a4268bba7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -35,45 +35,49 @@
|
||||
"dream2nix": {
|
||||
"inputs": {
|
||||
"alejandra": [
|
||||
"nci",
|
||||
"nixpkgs"
|
||||
"nci"
|
||||
],
|
||||
"all-cabal-json": [
|
||||
"nci"
|
||||
],
|
||||
"crane": "crane",
|
||||
"devshell": [
|
||||
"nci",
|
||||
"devshell"
|
||||
],
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-utils-pre-commit": [
|
||||
"nci",
|
||||
"nixpkgs"
|
||||
"nci"
|
||||
],
|
||||
"ghc-utils": [
|
||||
"nci"
|
||||
],
|
||||
"gomod2nix": [
|
||||
"nci",
|
||||
"nixpkgs"
|
||||
"nci"
|
||||
],
|
||||
"mach-nix": [
|
||||
"nci",
|
||||
"nixpkgs"
|
||||
"nci"
|
||||
],
|
||||
"nix-pypi-fetcher": [
|
||||
"nci"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nci",
|
||||
"nixpkgs"
|
||||
],
|
||||
"poetry2nix": [
|
||||
"nci",
|
||||
"nixpkgs"
|
||||
"nci"
|
||||
],
|
||||
"pre-commit-hooks": [
|
||||
"nci",
|
||||
"nixpkgs"
|
||||
"nci"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1662507674,
|
||||
"narHash": "sha256-vnXfje4pfTqDEqI837GCT+hNKqzfVwPen++gnLVO9F0=",
|
||||
"lastModified": 1671323629,
|
||||
"narHash": "sha256-9KHTPjIDjfnzZ4NjpE3gGIVHVHopy6weRDYO/7Y3hF8=",
|
||||
"owner": "nix-community",
|
||||
"repo": "dream2nix",
|
||||
"rev": "5ba9061857e3e265538c9785bb56bda2bb8f9bca",
|
||||
"rev": "2d7d68505c8619410df2c6b6463985f97cbcba6e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -82,6 +86,24 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1668450977,
|
||||
"narHash": "sha256-cfLhMhnvXn6x1vPm+Jow3RiFAUSCw/l1utktCw5rVA4=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "d591857e9d7dd9ddbfba0ea02b43b927c3c0f1fa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nci": {
|
||||
"inputs": {
|
||||
"devshell": "devshell",
|
||||
@ -90,11 +112,11 @@
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1662507702,
|
||||
"narHash": "sha256-Q8zfpLNCJublP7t4oHizr5tgsCS4BHFk7Fc7wzWbrzE=",
|
||||
"lastModified": 1671326550,
|
||||
"narHash": "sha256-FmGeaTd9FF64jhA8+J3ZJtFROQtfjeu1WESp+DRsVfg=",
|
||||
"owner": "yusdacra",
|
||||
"repo": "nix-cargo-integration",
|
||||
"rev": "97aa58c683ccf628175118052b3306f40ac21ca0",
|
||||
"rev": "44c525562513cd818e515f556fa4b7393939cc8e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -105,11 +127,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1662019588,
|
||||
"narHash": "sha256-oPEjHKGGVbBXqwwL+UjsveJzghWiWV0n9ogo1X6l4cw=",
|
||||
"lastModified": 1671200928,
|
||||
"narHash": "sha256-mZfzDyzojwj6I0wyooIjGIn81WtGVnx6+avU5Wv+VKU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2da64a81275b68fdad38af669afeda43d401e94b",
|
||||
"rev": "757b82211463dd5ba1475b6851d3731dfe14d377",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -119,6 +141,24 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1665349835,
|
||||
"narHash": "sha256-UK4urM3iN80UXQ7EaOappDzcisYIuEURFRoGQ/yPkug=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "34c5293a71ffdb2fe054eb5288adc1882c1eb0b1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nci": "nci"
|
||||
@ -127,11 +167,11 @@
|
||||
"rust-overlay": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1662433378,
|
||||
"narHash": "sha256-DqMtTtIownl+UIPG1O917IH10UF0Hwql636p22vOJfw=",
|
||||
"lastModified": 1671243596,
|
||||
"narHash": "sha256-vQ1q6uwx2gKsHbQVhkq17nT8HwUmRbIG8cJVFafNb5s=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "12aa8ea4381b28b7a3118f96682dc3ffb13fb6b6",
|
||||
"rev": "905db21103d646ddc1eb81920e05180e6e2b6734",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
193
flake.nix
193
flake.nix
@ -29,6 +29,8 @@
|
||||
"CODE_OF_CONDUCT.md"
|
||||
"clippy.toml"
|
||||
".cargo"
|
||||
".github"
|
||||
".gitlab"
|
||||
];
|
||||
ignorePaths = path: type: let
|
||||
split = lib.splitString "/" path;
|
||||
@ -43,9 +45,57 @@
|
||||
# filter out unnecessary paths
|
||||
filter = ignorePaths;
|
||||
};
|
||||
|
||||
wrapWithAssets = common: _: old: let
|
||||
pkgs = common.pkgs;
|
||||
checkIfLfsIsSetup = pkgs: checkFile: ''
|
||||
checkFile="${checkFile}"
|
||||
result="$(${pkgs.file}/bin/file --mime-type $checkFile)"
|
||||
if [ "$result" = "$checkFile: image/jpeg" ]; then
|
||||
echo "Git LFS seems to be setup properly."
|
||||
true
|
||||
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
|
||||
'';
|
||||
in
|
||||
inputs.nci.lib.makeOutputs {
|
||||
root = ./.;
|
||||
config = common: {
|
||||
cCompiler.package = common.pkgs.clang;
|
||||
outputs.defaults = {
|
||||
package = "veloren-voxygen";
|
||||
app = "veloren-voxygen";
|
||||
};
|
||||
shell = {
|
||||
startup.checkLfsSetup.text = ''
|
||||
${checkIfLfsIsSetup common.pkgs "$PWD/assets/voxygen/background/bg_main.jpg"}
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
pkgConfig = common: let
|
||||
inherit (common) pkgs;
|
||||
veloren-common-ov = {
|
||||
# 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 = true;
|
||||
# We don't add in any information here because otherwise anything
|
||||
# that depends on common will be recompiled. We will set these in
|
||||
# our wrapper instead.
|
||||
NIX_GIT_HASH = "";
|
||||
NIX_GIT_TAG = "";
|
||||
};
|
||||
wrapWithAssets = _: old: let
|
||||
runtimeLibs = with pkgs; [
|
||||
xorg.libX11
|
||||
xorg.libXi
|
||||
@ -61,27 +111,10 @@
|
||||
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
|
||||
${checkIfLfsIsSetup pkgs "$out/assets/voxygen/background/bg_main.jpg"}
|
||||
'';
|
||||
wrapped =
|
||||
common.internal.nci-pkgs.utils.wrapDerivation old
|
||||
common.internal.pkgsSet.utils.wrapDerivation old
|
||||
{nativeBuildInputs = [pkgs.makeWrapper];}
|
||||
''
|
||||
rm -rf $out/bin
|
||||
@ -95,53 +128,10 @@
|
||||
'';
|
||||
in
|
||||
wrapped;
|
||||
in
|
||||
inputs.nci.lib.makeOutputs {
|
||||
root = ./.;
|
||||
defaultOutputs = {
|
||||
package = "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 = {
|
||||
cCompiler = common: common.pkgs.clang;
|
||||
crates = common: prev: let
|
||||
pkgs = common.pkgs;
|
||||
|
||||
configMoldLinker = ''
|
||||
touch $CARGO_HOME/config.toml
|
||||
cat >>$CARGO_HOME/config.toml <<EOF
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
linker = "clang"
|
||||
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
|
||||
EOF
|
||||
'';
|
||||
in rec {
|
||||
veloren-common = oldAttrs: {
|
||||
# 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 = true;
|
||||
# We don't add in any information here because otherwise anything
|
||||
# that depends on common will be recompiled. We will set these in
|
||||
# our wrapper instead.
|
||||
NIX_GIT_HASH = "";
|
||||
NIX_GIT_TAG = "";
|
||||
};
|
||||
veloren-voxygen-deps = oldAttrs: {
|
||||
buildInputs = ncl.addBuildInputs prev (
|
||||
in {
|
||||
veloren-voxygen = let
|
||||
veloren-voxygen-deps-ov = oldAttrs: {
|
||||
buildInputs = ncl.addBuildInputs oldAttrs (
|
||||
with pkgs; [
|
||||
alsa-lib
|
||||
libxkbcommon
|
||||
@ -150,21 +140,24 @@
|
||||
]
|
||||
);
|
||||
nativeBuildInputs =
|
||||
ncl.addNativeBuildInputs prev (with pkgs; [python3 pkg-config mold]);
|
||||
ncl.addNativeBuildInputs oldAttrs (with pkgs; [python3 pkg-config]);
|
||||
|
||||
SHADERC_LIB_DIR = "${pkgs.shaderc.lib}/lib";
|
||||
|
||||
doCheck = false;
|
||||
|
||||
postConfigure = ''
|
||||
${oldAttrs.postConfigure or ""}
|
||||
${configMoldLinker}
|
||||
'';
|
||||
dontCheck = true;
|
||||
};
|
||||
veloren-voxygen = prev:
|
||||
ncl.computeOverridesResult prev [
|
||||
veloren-voxygen-deps
|
||||
(oldAttrs: {
|
||||
in {
|
||||
features = {
|
||||
release = ["default-publish"];
|
||||
dev = ["default-publish"];
|
||||
test = ["default-publish"];
|
||||
};
|
||||
depsOverrides.fix-build.overrideAttrs = veloren-voxygen-deps-ov;
|
||||
overrides = {
|
||||
fix-veloren-common = veloren-common-ov;
|
||||
add-deps-reqs.overrideAttrs = veloren-voxygen-deps-ov;
|
||||
fix-build.overrideAttrs = prev: {
|
||||
src = filteredSource;
|
||||
|
||||
VELOREN_USERDATA_STRATEGY = "system";
|
||||
@ -172,33 +165,37 @@
|
||||
dontUseCmakeConfigure = true;
|
||||
|
||||
preConfigure = ''
|
||||
${oldAttrs.preConfigure or ""}
|
||||
${prev.preConfigure or ""}
|
||||
substituteInPlace voxygen/src/audio/soundcache.rs \
|
||||
--replace \
|
||||
"../../../assets/voxygen/audio/null.ogg" \
|
||||
"${./assets/voxygen/audio/null.ogg}"
|
||||
'';
|
||||
})
|
||||
];
|
||||
veloren-server-cli-deps = oldAttrs: {
|
||||
nativeBuildInputs = ncl.addNativeBuildInputs prev [pkgs.mold];
|
||||
|
||||
doCheck = false;
|
||||
|
||||
postConfigure = ''
|
||||
${oldAttrs.postConfigure or ""}
|
||||
${configMoldLinker}
|
||||
'';
|
||||
};
|
||||
veloren-server-cli = prev:
|
||||
ncl.computeOverridesResult prev [
|
||||
veloren-server-cli-deps
|
||||
(oldAttrs: {
|
||||
};
|
||||
wrapper = wrapWithAssets;
|
||||
};
|
||||
veloren-server-cli = let
|
||||
veloren-server-cli-deps-ov = oldAttrs: {
|
||||
doCheck = false;
|
||||
dontCheck = true;
|
||||
};
|
||||
in {
|
||||
features = {
|
||||
release = ["default-publish"];
|
||||
dev = ["default-publish"];
|
||||
test = ["default-publish"];
|
||||
};
|
||||
depsOverrides.fix-build.overrideAttrs = veloren-server-cli-deps-ov;
|
||||
overrides = {
|
||||
fix-veloren-common = veloren-common-ov;
|
||||
add-deps-reqs.overrideAttrs = veloren-server-cli-deps-ov;
|
||||
fix-build = {
|
||||
src = filteredSource;
|
||||
|
||||
VELOREN_USERDATA_STRATEGY = "system";
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
wrapper = wrapWithAssets;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -7,15 +7,36 @@ t: let
|
||||
|
||||
# Courtesy of https://stackoverflow.com/a/32158604.
|
||||
z = days + 719468;
|
||||
era = (if z >= 0 then z else z - 146096) / 146097;
|
||||
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);
|
||||
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;
|
||||
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)}"
|
||||
|
Loading…
Reference in New Issue
Block a user