build(nix): update flake to use latest nix-cargo-integration

This commit is contained in:
Yusuf Bera Ertan 2022-01-03 08:54:16 +03:00
parent f45cb7ce3a
commit b9586673d5
No known key found for this signature in database
GPG Key ID: 1D8F8FAF2294D6EA
2 changed files with 112 additions and 47 deletions

View File

@ -1,12 +1,35 @@
{ {
"nodes": { "nodes": {
"devshell": { "crane": {
"flake": false,
"locked": { "locked": {
"lastModified": 1625086391, "lastModified": 1644785799,
"narHash": "sha256-IpNPv1v8s4L3CoxhwcgZIitGpcrnNgnj09X7TA0QV3k=", "narHash": "sha256-VpAJO1L0XeBvtCuNGK4IDKp6ENHIpTrlaZT7yfBCvwo=",
"owner": "ipetkov",
"repo": "crane",
"rev": "fc7a94f841347c88f2cb44217b2a3faa93e2a0b2",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"devshell": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nci",
"nixpkgs"
]
},
"locked": {
"lastModified": 1650900878,
"narHash": "sha256-qhNncMBSa9STnhiLfELEQpYC1L4GrYHNIzyCZ/pilsI=",
"owner": "numtide", "owner": "numtide",
"repo": "devshell", "repo": "devshell",
"rev": "4b5ac7cf7d9a1cc60b965bb51b59922f2210cbc7", "rev": "d97df53b5ddaa1cfbea7cddbd207eb2634304733",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -15,20 +38,84 @@
"type": "github" "type": "github"
} }
}, },
"nixCargoIntegration": { "dream2nix": {
"inputs": { "inputs": {
"devshell": "devshell", "alejandra": [
"nixpkgs": [ "nci",
"nixpkgs" "nixpkgs"
], ],
"crane": "crane",
"flake-utils-pre-commit": [
"nci",
"nixpkgs"
],
"gomod2nix": [
"nci",
"nixpkgs"
],
"mach-nix": [
"nci",
"nixpkgs"
],
"nixpkgs": [
"nci",
"nixpkgs"
],
"node2nix": [
"nci",
"nixpkgs"
],
"poetry2nix": [
"nci",
"nixpkgs"
],
"pre-commit-hooks": [
"nci",
"nixpkgs"
]
},
"locked": {
"lastModified": 1651053461,
"narHash": "sha256-OvIa0M9gHl3Vw5Nkiq3G9xmvbv5qjv4sDrVKfcpFQRI=",
"owner": "nix-community",
"repo": "dream2nix",
"rev": "1c8faf4882e91eb984d9dad18659ddeb29958b14",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "dream2nix",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1642700792,
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nci": {
"inputs": {
"devshell": "devshell",
"dream2nix": "dream2nix",
"nixpkgs": "nixpkgs",
"rustOverlay": "rustOverlay" "rustOverlay": "rustOverlay"
}, },
"locked": { "locked": {
"lastModified": 1627940369, "lastModified": 1651126504,
"narHash": "sha256-KtY837WKsX9B/pIKFDKzN0wl1t3et1JZjMjGa7SAZxI=", "narHash": "sha256-OUt4rJ3ld+e7nz/3rkcDSjAEk7qi9h3pRCHowSv7Vac=",
"owner": "yusdacra", "owner": "yusdacra",
"repo": "nix-cargo-integration", "repo": "nix-cargo-integration",
"rev": "fac8518469e226db4805ff80788979c847b0c322", "rev": "efcdcb01038d847e66ba55e23faa9242970663d7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -39,34 +126,33 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1627814220, "lastModified": 1651007983,
"narHash": "sha256-P+MDgdZw2CBk9X1ZZaUgHgN+32pTfLFf3XVIBOXirI4=", "narHash": "sha256-GNay7yDPtLcRcKCNHldug85AhAvBpTtPEJWSSDYBw8U=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ab5b6828af26215bf2646c31961da5d3749591ef", "rev": "e10da1c7f542515b609f8dfbcf788f3d85b14936",
"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": { "rustOverlay": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1627870491, "lastModified": 1651114831,
"narHash": "sha256-0Myg04QOIcTN1RhgfRNx0i/iCRyVyf/Z6rJxZUmot5k=", "narHash": "sha256-fbztwl7iIvnFwcm/u0Eigcvkl6uH97tEXUJqizbyl1k=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "71d825269cfaa30605d058bd92381be9af87b0be", "rev": "89e658c1c8d81eeaad78750ab29975594f57eda2",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -1,31 +1,17 @@
{ {
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 = {
url = "github:yusdacra/nix-cargo-integration";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs: outputs = inputs:
inputs.nixCargoIntegration.lib.makeOutputs { inputs.nci.lib.makeOutputs {
root = ./.; root = ./.;
buildPlatform = "crate2nix";
defaultOutputs = { defaultOutputs = {
package = "veloren-voxygen"; package = "veloren-voxygen";
app = "veloren-voxygen"; app = "veloren-voxygen";
}; };
overrides = { overrides = {
build = common: prev: { crates = common: prev:
runTests = !prev.release && prev.runTests;
rootFeatures =
if prev.release && common.cargoPkg.name == "veloren-voxygen"
then [ "default-publish" ]
else prev.rootFeatures;
};
crateOverrides = common: prev:
let let
pkgs = common.pkgs; pkgs = common.pkgs;
lib = common.lib; lib = common.lib;
@ -64,15 +50,6 @@
''; '';
in in
{ {
# 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
@ -80,9 +57,9 @@
# 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 = prettyRev; NIX_GIT_HASH = prettyRev;
NIX_GIT_TAG = tag; NIX_GIT_TAG = tag;
crateBin = lib.filter (bin: bin.name != "csv_export" && bin.name != "csv_import" && bin.name != "recipe_graphviz") oldAttrs.crateBin;
}; };
veloren-voxygen = oldAttrs: { veloren-voxygen = oldAttrs: {
nativeBuildInputs = (oldAttrs.nativeBuildInputs or []) ++ [ pkgs.makeWrapper ];
VELOREN_USERDATA_STRATEGY = "system"; VELOREN_USERDATA_STRATEGY = "system";
preConfigure = '' preConfigure = ''
substituteInPlace src/audio/soundcache.rs \ substituteInPlace src/audio/soundcache.rs \
@ -99,10 +76,12 @@
''; '';
}; };
veloren-server-cli = oldAttrs: { veloren-server-cli = oldAttrs: {
nativeBuildInputs = (oldAttrs.nativeBuildInputs or []) ++ [ pkgs.makeWrapper ];
VELOREN_USERDATA_STRATEGY = "system"; VELOREN_USERDATA_STRATEGY = "system";
postInstall = '' postInstall = ''
if [ -f $out/bin/veloren-server-cli ]; then if [ -f $out/bin/veloren-server-cli ]; then
wrapProgram $out/bin/veloren-server-cli --set VELOREN_ASSETS ${veloren-assets} wrapProgram $out/bin/veloren-server-cli \
--set VELOREN_ASSETS ${veloren-assets}
fi fi
''; '';
}; };