nix: regenerate Cargo.nix, update dependencies, some tweaks for better reproducibility, remove rustup from shell.nix (causes issues) and add rustc, cargo instead

This commit is contained in:
Yusuf Bera Ertan 2020-07-16 13:40:39 +00:00 committed by Marcel
parent 20af325165
commit f49b4a9908
8 changed files with 507 additions and 695 deletions

1
nix/.envrc Normal file
View File

@ -0,0 +1 @@
use nix

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@
"guillotiere 0.4.2 (git+https://github.com/Imberflur/guillotiere#42c298f5bcf0f95f1a004360d05e25ca3711e9ed)": "1knqbn777f3cgzbsaqawzclgrqf3nav6x3gjzc2hsls3acccx1ya", "guillotiere 0.4.2 (git+https://github.com/Imberflur/guillotiere#42c298f5bcf0f95f1a004360d05e25ca3711e9ed)": "1knqbn777f3cgzbsaqawzclgrqf3nav6x3gjzc2hsls3acccx1ya",
"msgbox 0.4.0 (git+https://github.com/bekker/msgbox-rs.git?rev=68fe39a#68fe39a60019b38a1569ae4e9ed796a0f0542673)": "18h6s50n7mz2ggfishhi91p2298shqhzx5xagpg9q4zb4y90c2wr", "msgbox 0.4.0 (git+https://github.com/bekker/msgbox-rs.git?rev=68fe39a#68fe39a60019b38a1569ae4e9ed796a0f0542673)": "18h6s50n7mz2ggfishhi91p2298shqhzx5xagpg9q4zb4y90c2wr",
"portpicker 0.1.0 (git+https://github.com/xMAC94x/portpicker-rs#9d6df36c53c94684080a64a7212dd6bfc3617ee4)": "00vl2k3xfihxq86kf5rsknjl8dxmrxqhwajwn0hj4gzgnbssr0rx", "portpicker 0.1.0 (git+https://github.com/xMAC94x/portpicker-rs#9d6df36c53c94684080a64a7212dd6bfc3617ee4)": "00vl2k3xfihxq86kf5rsknjl8dxmrxqhwajwn0hj4gzgnbssr0rx",
"specs-idvs 0.1.0 (git+https://gitlab.com/veloren/specs-idvs.git#111548cf44e9bb4c43feb12aa3fc253953ac6e4a)": "1qgbzr4g4iys10hi56l6z7k3gk9qwj9xamfdigqnkhxvcynfhqqv", "specs 0.16.1 (git+https://github.com/amethyst/specs.git?rev=7a2e348ab2223818bad487695c66c43db88050a5#7a2e348ab2223818bad487695c66c43db88050a5)": "1z7gjiq7zirg9az3ly1y2ghi5m7s3x1bp35gw5x0cyv50fsi3pjq",
"specs-idvs 0.1.0 (git+https://gitlab.com/veloren/specs-idvs.git?branch=specs-git#fcb0b2306b571f62f9f85d89e79e087454d95efd)": "00w4kc60d7mjb5gbkcxrxzarshmhf4idqm3sk8335f7s3pn9q0s5",
"treeculler 0.1.0 (git+https://gitlab.com/yusdacra/treeculler.git#efcf5283cf386117a7e654abdaa45ef664a08e42)": "19niwgha0jnvrp22pq0070dfimb2wkda53a3parhga3vhap2g01b" "treeculler 0.1.0 (git+https://gitlab.com/yusdacra/treeculler.git#efcf5283cf386117a7e654abdaa45ef664a08e42)": "19niwgha0jnvrp22pq0070dfimb2wkda53a3parhga3vhap2g01b"
} }

View File

@ -1,12 +1,23 @@
{ crateName ? "veloren-voxygen", { crateName ? "veloren-voxygen",
# `crate2nix` doesn't support profiles in `Cargo.toml`, so default to release. Otherwise bad performance (non-release is built with opt level 0) # `crate2nix` doesn't support profiles in `Cargo.toml`, so default to release. Otherwise bad performance (non-release is built with opt level 0)
release ? true, sources ? import ./sources.nix { }, nixpkgsSrc ? <nixpkgs> }: release ? true, nixpkgs ? <nixpkgs>, system ? builtins.currentSystem
, sources ? import ./sources.nix { inherit system; } }:
let let
# Check if git-lfs is working. gitHash =
isGitLfsSetup = # Check if git-lfs is working.
if builtins.pathExists ../assets/voxygen/background/bg_main.png then if builtins.pathExists ../assets/voxygen/background/bg_main.png then
true builtins.readFile (pkgs.runCommand "getGitHash" { } ''
cd ${
# Only copy the `.git` directory to nix store, anything else is a waste.
builtins.path {
path = ../.git;
# Nix store path names don't accept names that start with a dot.
name = "git";
}
}
${pkgs.git}/bin/git log -n 1 --pretty=format:%h/%cd --date=format:%Y-%m-%d-%H:%M --abbrev=8 > $out
'')
else else
abort '' abort ''
Git Large File Storage (git-lfs) has not been set up correctly. Git Large File Storage (git-lfs) has not been set up correctly.
@ -17,34 +28,17 @@ let
See the book at https://book.veloren.net/ for details. See the book at https://book.veloren.net/ for details.
''; '';
pkgs = import ./nixpkgs.nix { inherit sources nixpkgsSrc; }; pkgs = import ./nixpkgs.nix { inherit sources nixpkgs system; };
# Only copy the `.git` directory to nix store, anything else is a waste.
gitSrc = builtins.path {
path = ../.git;
name = "git";
};
gitHash = builtins.readFile (with pkgs;
runCommand "getGitHash" { nativeBuildInputs = [ git ]; } ''
cd ${gitSrc}
git log -n 1 --pretty=format:%h/%cd --date=format:%Y-%m-%d-%H:%M --abbrev=8 > $out
'');
veloren = with pkgs; veloren = with pkgs;
callPackage ./Cargo.nix { callPackage ./Cargo.nix {
defaultCrateOverrides = defaultCrateOverrides // { defaultCrateOverrides = defaultCrateOverrides // {
libudev-sys = attrs: { buildInputs = [ pkg-config libudev ]; }; libudev-sys = _: { buildInputs = [ pkg-config libudev ]; };
alsa-sys = attrs: { buildInputs = [ pkg-config alsaLib ]; }; alsa-sys = _: { buildInputs = [ pkg-config alsaLib ]; };
veloren-common = attrs: { veloren-common = _: { NIX_GIT_HASH = gitHash; };
NIX_GIT_HASH = gitHash; veloren-network = _: { buildInputs = [ pkg-config openssl ]; };
# We need to include the result here otherwise nix won't evaluate the check. veloren-voxygen = _: { buildInputs = [ atk cairo glib gtk3 pango ]; };
GIT_LFS_SETUP = isGitLfsSetup;
};
veloren-network = attrs: { buildInputs = [ pkg-config openssl ]; };
veloren-voxygen = attrs: {
buildInputs = [ atk cairo glib gtk3 pango ];
};
}; };
inherit release pkgs; inherit release pkgs nixpkgs;
}; };
in veloren.workspaceMembers."${crateName}".build in veloren.workspaceMembers."${crateName}".build

View File

@ -1,11 +1,16 @@
{ sources ? import ./sources.nix { }, nixpkgsSrc ? <nixpkgs> }: { nixpkgs ? <nixpkgs>, system ? builtins.currentSystem
, sources ? import ./sources.nix { inherit system; } }:
let let
mozPkgs = import "${sources.nixpkgsMoz}/package-set.nix" { mozPkgs = import "${sources.nixpkgsMoz}/package-set.nix" {
pkgs = import nixpkgsSrc { }; pkgs = import nixpkgs { inherit system; };
}; };
rustChannel = mozPkgs.rustChannelOf { rustToolchain = ../rust-toolchain; }; rustChannel = mozPkgs.rustChannelOf {
in import nixpkgsSrc { rustToolchain = ../rust-toolchain;
sha256 = "sha256-18R7sZfLGmtYkz24jUaq268fJO2A71p+dWvGm4DgqEw=";
};
in import nixpkgs {
inherit system;
overlays = [ overlays = [
(self: super: { (self: super: {
rustc = rustChannel.rust; rustc = rustChannel.rust;

View File

@ -1,6 +1,9 @@
{ sources ? import ./sources.nix { }, pkgs ? import <nixpkgs> { } }: { nixpkgs ? <nixpkgs>, sources ? import ./sources.nix { }
, system ? builtins.currentSystem }:
let crate2nix = import sources.crate2nix { }; let
pkgs = import ./nixpkgs.nix { inherit sources nixpkgs system; };
crate2nix = import sources.crate2nix { inherit pkgs; };
in pkgs.mkShell { in pkgs.mkShell {
name = "veloren-shell"; name = "veloren-shell";
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
@ -11,7 +14,8 @@ in pkgs.mkShell {
niv niv
nixfmt nixfmt
crate2nix crate2nix
rustup cargo
rustc
]; ];
buildInputs = with pkgs; [ buildInputs = with pkgs; [
alsaLib alsaLib

View File

@ -5,10 +5,10 @@
"homepage": "", "homepage": "",
"owner": "kolloch", "owner": "kolloch",
"repo": "crate2nix", "repo": "crate2nix",
"rev": "87a544222723693c81f3b4141d639ba9b5769e2e", "rev": "5dfb0c155ca639591b82106b6455f24fc0a2f484",
"sha256": "0rml8xy7b6qlx631wpa29yb8qjsilv55w6g5rqbqjyw22aqz4ppb", "sha256": "0nkvpk3m8wgnwd94520jnsxjq14q255s67rl885i75rm293j2yha",
"type": "tarball", "type": "tarball",
"url": "https://github.com/kolloch/crate2nix/archive/87a544222723693c81f3b4141d639ba9b5769e2e.tar.gz", "url": "https://github.com/kolloch/crate2nix/archive/5dfb0c155ca639591b82106b6455f24fc0a2f484.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": {
@ -17,10 +17,10 @@
"homepage": null, "homepage": null,
"owner": "mozilla", "owner": "mozilla",
"repo": "nixpkgs-mozilla", "repo": "nixpkgs-mozilla",
"rev": "e912ed483e980dfb4666ae0ed17845c4220e5e7c", "rev": "18cd4300e9bf61c7b8b372f07af827f6ddc835bb",
"sha256": "08fvzb8w80bkkabc1iyhzd15f4sm7ra10jn32kfch5klgl0gj3j3", "sha256": "1s0d1l5y7a3kygjbibssjnj7fcc87qaa5s9k4kda0j13j9h4zwgr",
"type": "tarball", "type": "tarball",
"url": "https://github.com/mozilla/nixpkgs-mozilla/archive/e912ed483e980dfb4666ae0ed17845c4220e5e7c.tar.gz", "url": "https://github.com/mozilla/nixpkgs-mozilla/archive/18cd4300e9bf61c7b8b372f07af827f6ddc835bb.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
} }
} }

View File

@ -1,5 +1,5 @@
# This file has been generated by Niv. # This file has been generated by Niv.
{ system ? builtins.currentSystem }:
let let
# #
@ -61,7 +61,7 @@ let
in if builtins.hasAttr "nixpkgs" sources then in if builtins.hasAttr "nixpkgs" sources then
sourcesNixpkgs sourcesNixpkgs
else if hasNixpkgsPath && !hasThisAsNixpkgsPath then else if hasNixpkgsPath && !hasThisAsNixpkgsPath then
import <nixpkgs> { } import <nixpkgs> { inherit system; }
else else
abort '' abort ''
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or