mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
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:
parent
20af325165
commit
f49b4a9908
1
nix/.envrc
Normal file
1
nix/.envrc
Normal file
@ -0,0 +1 @@
|
||||
use nix
|
1109
nix/Cargo.nix
1109
nix/Cargo.nix
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,7 @@
|
||||
"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",
|
||||
"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"
|
||||
}
|
@ -1,12 +1,23 @@
|
||||
{ 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)
|
||||
release ? true, sources ? import ./sources.nix { }, nixpkgsSrc ? <nixpkgs> }:
|
||||
release ? true, nixpkgs ? <nixpkgs>, system ? builtins.currentSystem
|
||||
, sources ? import ./sources.nix { inherit system; } }:
|
||||
|
||||
let
|
||||
gitHash =
|
||||
# Check if git-lfs is working.
|
||||
isGitLfsSetup =
|
||||
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
|
||||
abort ''
|
||||
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.
|
||||
'';
|
||||
|
||||
pkgs = import ./nixpkgs.nix { inherit sources nixpkgsSrc; };
|
||||
|
||||
# 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
|
||||
'');
|
||||
pkgs = import ./nixpkgs.nix { inherit sources nixpkgs system; };
|
||||
|
||||
veloren = with pkgs;
|
||||
callPackage ./Cargo.nix {
|
||||
defaultCrateOverrides = defaultCrateOverrides // {
|
||||
libudev-sys = attrs: { buildInputs = [ pkg-config libudev ]; };
|
||||
alsa-sys = attrs: { buildInputs = [ pkg-config alsaLib ]; };
|
||||
veloren-common = attrs: {
|
||||
NIX_GIT_HASH = gitHash;
|
||||
# We need to include the result here otherwise nix won't evaluate the check.
|
||||
GIT_LFS_SETUP = isGitLfsSetup;
|
||||
libudev-sys = _: { buildInputs = [ pkg-config libudev ]; };
|
||||
alsa-sys = _: { buildInputs = [ pkg-config alsaLib ]; };
|
||||
veloren-common = _: { NIX_GIT_HASH = gitHash; };
|
||||
veloren-network = _: { buildInputs = [ pkg-config openssl ]; };
|
||||
veloren-voxygen = _: { buildInputs = [ atk cairo glib gtk3 pango ]; };
|
||||
};
|
||||
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
|
||||
|
@ -1,11 +1,16 @@
|
||||
{ sources ? import ./sources.nix { }, nixpkgsSrc ? <nixpkgs> }:
|
||||
{ nixpkgs ? <nixpkgs>, system ? builtins.currentSystem
|
||||
, sources ? import ./sources.nix { inherit system; } }:
|
||||
|
||||
let
|
||||
mozPkgs = import "${sources.nixpkgsMoz}/package-set.nix" {
|
||||
pkgs = import nixpkgsSrc { };
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
};
|
||||
rustChannel = mozPkgs.rustChannelOf { rustToolchain = ../rust-toolchain; };
|
||||
in import nixpkgsSrc {
|
||||
rustChannel = mozPkgs.rustChannelOf {
|
||||
rustToolchain = ../rust-toolchain;
|
||||
sha256 = "sha256-18R7sZfLGmtYkz24jUaq268fJO2A71p+dWvGm4DgqEw=";
|
||||
};
|
||||
in import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
(self: super: {
|
||||
rustc = rustChannel.rust;
|
||||
|
@ -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 {
|
||||
name = "veloren-shell";
|
||||
nativeBuildInputs = with pkgs; [
|
||||
@ -11,7 +14,8 @@ in pkgs.mkShell {
|
||||
niv
|
||||
nixfmt
|
||||
crate2nix
|
||||
rustup
|
||||
cargo
|
||||
rustc
|
||||
];
|
||||
buildInputs = with pkgs; [
|
||||
alsaLib
|
||||
|
@ -5,10 +5,10 @@
|
||||
"homepage": "",
|
||||
"owner": "kolloch",
|
||||
"repo": "crate2nix",
|
||||
"rev": "87a544222723693c81f3b4141d639ba9b5769e2e",
|
||||
"sha256": "0rml8xy7b6qlx631wpa29yb8qjsilv55w6g5rqbqjyw22aqz4ppb",
|
||||
"rev": "5dfb0c155ca639591b82106b6455f24fc0a2f484",
|
||||
"sha256": "0nkvpk3m8wgnwd94520jnsxjq14q255s67rl885i75rm293j2yha",
|
||||
"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"
|
||||
},
|
||||
"nixpkgsMoz": {
|
||||
@ -17,10 +17,10 @@
|
||||
"homepage": null,
|
||||
"owner": "mozilla",
|
||||
"repo": "nixpkgs-mozilla",
|
||||
"rev": "e912ed483e980dfb4666ae0ed17845c4220e5e7c",
|
||||
"sha256": "08fvzb8w80bkkabc1iyhzd15f4sm7ra10jn32kfch5klgl0gj3j3",
|
||||
"rev": "18cd4300e9bf61c7b8b372f07af827f6ddc835bb",
|
||||
"sha256": "1s0d1l5y7a3kygjbibssjnj7fcc87qaa5s9k4kda0j13j9h4zwgr",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
# This file has been generated by Niv.
|
||||
|
||||
{ system ? builtins.currentSystem }:
|
||||
let
|
||||
|
||||
#
|
||||
@ -61,7 +61,7 @@ let
|
||||
in if builtins.hasAttr "nixpkgs" sources then
|
||||
sourcesNixpkgs
|
||||
else if hasNixpkgsPath && !hasThisAsNixpkgsPath then
|
||||
import <nixpkgs> { }
|
||||
import <nixpkgs> { inherit system; }
|
||||
else
|
||||
abort ''
|
||||
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
|
||||
|
Loading…
Reference in New Issue
Block a user