refactor(tools): move crate2nix generate here
Having something running the depot crate2nix and formatting it with depotfmt is useful outside of tvix too. Change-Id: Iecc8f207da38cc6995747c5ea48d3911433fd416 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10658 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz>
This commit is contained in:
parent
93afc711f6
commit
4497ac41ab
3 changed files with 11 additions and 10 deletions
8
tools/crate2nix-generate.nix
Normal file
8
tools/crate2nix-generate.nix
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{ pkgs, depot, ... }:
|
||||||
|
|
||||||
|
# Run crate2nix generate in the current working directory, then
|
||||||
|
# format the generated file with depotfmt.
|
||||||
|
pkgs.writeShellScriptBin "crate2nix-generate" ''
|
||||||
|
${pkgs.crate2nix}/bin/crate2nix generate --all-features
|
||||||
|
${depot.tools.depotfmt}/bin/depotfmt Cargo.nix
|
||||||
|
''
|
|
@ -90,7 +90,7 @@ configuration.
|
||||||
|
|
||||||
When making changes to Cargo dependency configuration in any of the
|
When making changes to Cargo dependency configuration in any of the
|
||||||
Rust projects under `//tvix`, be sure to run
|
Rust projects under `//tvix`, be sure to run
|
||||||
`mg run //tvix:crate2nix-generate` in `//tvix` itself and commit the changes
|
`mg run //tools:crate2nix-generate` in `//tvix` itself and commit the changes
|
||||||
to the generated `Cargo.nix` file. This only applies to the full TVL checkout.
|
to the generated `Cargo.nix` file. This only applies to the full TVL checkout.
|
||||||
|
|
||||||
## License structure
|
## License structure
|
||||||
|
|
|
@ -88,13 +88,6 @@ let
|
||||||
# The cleaned sources.
|
# The cleaned sources.
|
||||||
src = depot.third_party.gitignoreSource ./.;
|
src = depot.third_party.gitignoreSource ./.;
|
||||||
|
|
||||||
# Run crate2nix generate in the current working directory, then
|
|
||||||
# format the generated file with depotfmt.
|
|
||||||
crate2nix-generate = pkgs.writeShellScriptBin "crate2nix-generate" ''
|
|
||||||
${pkgs.crate2nix}/bin/crate2nix generate --all-features
|
|
||||||
${depot.tools.depotfmt}/bin/depotfmt Cargo.nix
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Target containing *all* tvix proto files.
|
# Target containing *all* tvix proto files.
|
||||||
# Useful for workspace-wide cargo invocations (doc, clippy)
|
# Useful for workspace-wide cargo invocations (doc, clippy)
|
||||||
protos = pkgs.symlinkJoin {
|
protos = pkgs.symlinkJoin {
|
||||||
|
@ -108,7 +101,7 @@ let
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit crates crate2nix-generate protos;
|
inherit crates protos;
|
||||||
|
|
||||||
# Run crate2nix generate, ensure the output doesn't differ afterwards
|
# Run crate2nix generate, ensure the output doesn't differ afterwards
|
||||||
# (and doesn't fail).
|
# (and doesn't fail).
|
||||||
|
@ -145,7 +138,7 @@ in
|
||||||
# running this command counteracts depotfmt brokenness
|
# running this command counteracts depotfmt brokenness
|
||||||
git init
|
git init
|
||||||
|
|
||||||
${crate2nix-generate}/bin/crate2nix-generate
|
${depot.tools.crate2nix-generate}/bin/crate2nix-generate
|
||||||
|
|
||||||
# technically unnecessary, but provides more-helpful output in case of error
|
# technically unnecessary, but provides more-helpful output in case of error
|
||||||
diff -ur Cargo.nix ${src}/Cargo.nix
|
diff -ur Cargo.nix ${src}/Cargo.nix
|
||||||
|
|
Loading…
Reference in a new issue