Please commit Cargo.lock file
Closed this issue · 2 comments
Please consider committing your Cargo.lock file: https://doc.rust-lang.org/cargo/faq.html#why-do-binaries-have-cargolock-in-version-control-but-not-libraries
The purpose of a Cargo.lock lockfile is to describe the state of the world at the time of a successful build. Cargo uses the lockfile to provide deterministic builds on different times and different systems, by ensuring that the exact same dependencies and versions are used as when the Cargo.lock file was originally generated.
This property is most desirable from applications and packages which are at the very end of the dependency chain (binaries). As a result, it is recommended that all binaries check in their Cargo.lock.
I'd like to make use of your package from a Nix derivation, and the tooling is built to consume Cargo.lock files: https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/rust.section.md#buildrustpackage-compiling-rust-applications-with-cargo-compiling-rust-applications-with-cargo
I'd like to make use of your package from a Nix derivation, and the tooling is built to consume Cargo.lock files
Would contributing the derivation directly be an option / useful? In that case you could just create a PR to add both the lockfile and the derivation file (or whatever it is nix uses).
I decided to keep it simple without the Nix derivation.
Here is a starting point for a Nix derivation, that could be contributed at a later stage:
# https://github.com/masklinn/xls2txt
# https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/rust.section.md
{ lib, fetchFromGitHub, rustPlatform }:
rustPlatform.buildRustPackage rec {
pname = "xls2txt";
version = "40b19a20b1118815c7c40cd6da7293be19878eda";
src = fetchFromGitHub {
owner = "masklinn";
repo = pname;
rev = version;
# hash = lib.fakeHash;
# hash = lib.fakeSha256;
hash = "sha256-Ei+tZ3Q75exExlF6lrMoQx/GWCO/fUOfJadDr5T6NpA=";
};
# https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
# https://doc.rust-lang.org/cargo/faq.html#why-do-binaries-have-cargolock-in-version-control-but-not-libraries
doCheck = false;
# https://github.com/search?q=repo%3ANixOS%2Fnixpkgs%20cargo.lock.patch&type=code
# https://github.com/masklinn/xls2txt/issues/3
# https://github.com/masklinn/xls2txt/pull/4
# todo: remove cargoPatches if PR is accepted
cargoPatches = [
./add-Cargo.lock.patch
];
cargoHash = "sha256-XUX3seIK5582CUy1lSN6G6CtBNBbbuJXvRf96neuBfs=";
# cargoSha256 = lib.fakeSha256;
# cargoHash = lib.fakeSha256;
# cargoHash = "sha256-jtBw4ahSl88L0iuCXxQgZVm1EcboWRJMNtjxLVTtzts=";
# cargoHash = "sha256-rGkPma6djJlh5I/my3jRuv3Vt9ODndT5AElh1sZXOys=";
# postInstall = ''
# ls -al
# ls $out
# '';
meta = with lib; {
description = "Utility for converting excel or opendocument spreadsheet files to text";
homepage = "https://github.com/masklinn/xls2txt";
license = licenses.unlicense;
maintainers = [ maintainers.masklinn ];
};
}