mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
build(nix): add source filtering for server-cli, use mold for server-cli too
This commit is contained in:
parent
5bf1a0267f
commit
b442b016a6
@ -90,11 +90,11 @@
|
|||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1662143940,
|
"lastModified": 1662158571,
|
||||||
"narHash": "sha256-3eJfehnZLWJGXylfpAMeLR0Q3sx8pAjGiHBQPqOH9+U=",
|
"narHash": "sha256-w+iLHikl1gdbzT9bM5Iu8u9k6/e2LljoTLyTWO0c0nk=",
|
||||||
"owner": "yusdacra",
|
"owner": "yusdacra",
|
||||||
"repo": "nix-cargo-integration",
|
"repo": "nix-cargo-integration",
|
||||||
"rev": "e83f2598aecbe1114783ff9bdae0b85939de35a3",
|
"rev": "013350ad83767cf359882e900de381a624445947",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
63
flake.nix
63
flake.nix
@ -63,6 +63,30 @@
|
|||||||
rustflags = ["-C", "link-arg=-fuse-ld=${lib.getExe pkgs.mold}"]
|
rustflags = ["-C", "link-arg=-fuse-ld=${lib.getExe pkgs.mold}"]
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
pathsToIgnore = [
|
||||||
|
"flake.nix"
|
||||||
|
"flake.lock"
|
||||||
|
"nix"
|
||||||
|
"assets"
|
||||||
|
"README.md"
|
||||||
|
"CONTRIBUTING.md"
|
||||||
|
"CHANGELOG.md"
|
||||||
|
"CODE_OF_CONDUCT.md"
|
||||||
|
"clippy.toml"
|
||||||
|
];
|
||||||
|
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;
|
||||||
|
filteredSource = builtins.path {
|
||||||
|
name = "veloren-source";
|
||||||
|
path = toString ./.;
|
||||||
|
# filter out unnecessary paths
|
||||||
|
filter = ignorePaths;
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
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
|
||||||
@ -81,26 +105,7 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
veloren-voxygen = oldAttrs: {
|
veloren-voxygen = oldAttrs: {
|
||||||
src = builtins.path {
|
src = filteredSource;
|
||||||
name = "veloren-source";
|
|
||||||
path = toString ./.;
|
|
||||||
# filter out unnecessary paths
|
|
||||||
filter = path: type:
|
|
||||||
lib.all
|
|
||||||
(n: builtins.baseNameOf path != n)
|
|
||||||
[
|
|
||||||
"flake.nix"
|
|
||||||
"flake.lock"
|
|
||||||
"nix"
|
|
||||||
"assets"
|
|
||||||
"README.md"
|
|
||||||
"CONTRIBUTING.md"
|
|
||||||
"CHANGELOG.md"
|
|
||||||
"CODE_OF_CONDUCT.md"
|
|
||||||
"clippy.toml"
|
|
||||||
"server-cli"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
buildInputs =
|
buildInputs =
|
||||||
(oldAttrs.buildInputs or [])
|
(oldAttrs.buildInputs or [])
|
||||||
@ -142,9 +147,25 @@
|
|||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
veloren-server-cli-deps = oldAttrs: {
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
|
postConfigure = ''
|
||||||
|
${oldAttrs.postConfigure or ""}
|
||||||
|
${configMoldLinker}
|
||||||
|
'';
|
||||||
|
};
|
||||||
veloren-server-cli = oldAttrs: {
|
veloren-server-cli = oldAttrs: {
|
||||||
nativeBuildInputs = (oldAttrs.nativeBuildInputs or []) ++ [pkgs.makeWrapper];
|
src = filteredSource;
|
||||||
|
|
||||||
VELOREN_USERDATA_STRATEGY = "system";
|
VELOREN_USERDATA_STRATEGY = "system";
|
||||||
|
|
||||||
|
nativeBuildInputs = (oldAttrs.nativeBuildInputs or []) ++ [pkgs.makeWrapper];
|
||||||
|
|
||||||
|
postConfigure = ''
|
||||||
|
${oldAttrs.postConfigure or ""}
|
||||||
|
${configMoldLinker}
|
||||||
|
'';
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
${oldAttrs.postInstall or ""}
|
${oldAttrs.postInstall or ""}
|
||||||
if [ -f $out/bin/veloren-server-cli ]; then
|
if [ -f $out/bin/veloren-server-cli ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user