about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-01-18T09·24+0200
committerclbot <clbot@tvl.fyi>2024-01-18T15·02+0000
commit4497ac41ab63a24499e796ff5f50ff79970c5727 (patch)
tree5bb952ff9b34b561d089a675e73ab0e746161262 /tools
parent93afc711f65784ed258834613937ca5177201a82 (diff)
refactor(tools): move crate2nix generate here r/7413
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/crate2nix-generate.nix8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/crate2nix-generate.nix b/tools/crate2nix-generate.nix
new file mode 100644
index 000000000000..a627588ae34b
--- /dev/null
+++ b/tools/crate2nix-generate.nix
@@ -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
+''