chore: move all 3p buildRustCrate derivations to //third_party

Profpatsch and me are basically the only users of
depot.users.Profpatsch.writers.rustSimple*. To pull in the odd
dependency we usually use buildRustCrate which is rather convenient.
However we've picked up the bad habit of inlining these in a let
somewhere instead of managing them in a more central location although
there has been an (unsuccesful) attempt at this in
//users/Profpatsch/rust-crates.nix.

This CL moves all buildRustCrate based derivations into
third_party.rust-crates and deletes any duplicate derivations we have
accumulated in the tree.

Change-Id: I8f68b95ebd546708e9af07dca36d72dba9ca8c77
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2769
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: Profpatsch <mail@profpatsch.de>
This commit is contained in:
sterni 2021-04-02 21:59:25 +02:00
parent 3e7073f106
commit 0133fdc737
7 changed files with 76 additions and 84 deletions

4
third_party/rust-crates/OWNERS vendored Normal file
View file

@ -0,0 +1,4 @@
inherited: true
owners:
- sterni
- Profpatsch

View file

@ -1,4 +1,11 @@
{ depot, pkgs, ... }: { depot, pkgs, ... }:
let
inherit (pkgs)
buildRustCrate
;
in
rec { rec {
cfg-if = pkgs.buildRustCrate { cfg-if = pkgs.buildRustCrate {
pname = "cfg-if"; pname = "cfg-if";
@ -208,4 +215,58 @@ rec {
sha256 = "0dgmgdmrfbjkpxn1w3xmmwsm2a623a9qdwn90s8yl78n4a36kbh9"; sha256 = "0dgmgdmrfbjkpxn1w3xmmwsm2a623a9qdwn90s8yl78n4a36kbh9";
}; };
serde = buildRustCrate {
pname = "serde";
crateName = "serde";
version = "1.0.123";
sha256 = "05xl2s1vpf3p7fi2yc9qlzw88d5ap0z3qmhmd7axa6pp9pn1s5xc";
features = [ "std" ];
};
ryu = buildRustCrate {
pname = "ryu";
version = "1.0.5";
crateName = "ryu";
sha256 = "060y2ln1csix593ingwxr2y3wl236ls0ly1ffkv39h5im7xydhrc";
};
itoa = buildRustCrate {
pname = "itoa";
version = "0.4.7";
crateName = "itoa";
sha256 = "0079jlkcmcaw37wljrvb6r3dqq15nfahkqnl5npvlpdvkg31k11x";
};
serde_json = buildRustCrate {
pname = "serde_json";
version = "1.0.62";
crateName = "serde_json";
sha256 = "0sgc8dycigq0nxr4j613m4q733alfb2i10s6nz80lsbbqgrka21q";
dependencies = [ serde ryu itoa ];
features = [ "std" ];
edition = "2018";
};
log = pkgs.buildRustCrate {
pname = "log";
version = "0.4.11";
crateName = "log";
sha256 = "0m6xhqxsps5mgd7r91g5mqkndbh8zbjd58p7w75r330zl4n40l07";
dependencies = [ cfg-if ];
};
serde_derive = pkgs.buildRustCrate {
pname = "serde";
crateName = "serde";
version = "1.0.123";
sha256 = "05xl2s1vpf3p7fi2yc9qlzw88d5ap0z3qmhmd7axa6pp9pn1s5xc";
};
mustache = pkgs.buildRustCrate {
pname = "mustache";
version = "0.9.0";
crateName = "mustache";
sha256 = "1zgl8l15i19lzp90icgwyi6zqdd31b9vm8w129f41d1zd0hs7ayq";
dependencies = [ log serde ];
};
} }

View file

@ -5,8 +5,8 @@ let
name = "imap-idle"; name = "imap-idle";
dependencies = [ dependencies = [
depot.users.Profpatsch.arglib.netencode.rust depot.users.Profpatsch.arglib.netencode.rust
depot.users.Profpatsch.rust-crates.imap depot.third_party.rust-crates.imap
depot.users.Profpatsch.rust-crates.epoll depot.third_party.rust-crates.epoll
depot.users.Profpatsch.execline.exec-helpers depot.users.Profpatsch.execline.exec-helpers
]; ];
} (builtins.readFile ./imap-idle.rs); } (builtins.readFile ./imap-idle.rs);

View file

@ -10,7 +10,7 @@ let
(imports.writers.rustSimpleLib { (imports.writers.rustSimpleLib {
name = "netencode"; name = "netencode";
dependencies = [ dependencies = [
depot.users.Profpatsch.rust-crates.nom depot.third_party.rust-crates.nom
depot.users.Profpatsch.execline.exec-helpers depot.users.Profpatsch.execline.exec-helpers
]; ];
release = false; release = false;
@ -19,50 +19,12 @@ let
gen = import ./gen.nix { inherit lib; }; gen = import ./gen.nix { inherit lib; };
cfg-if = pkgs.buildRustCrate {
pname = "cfg-if";
version = "1.0.0";
crateName = "cfg-if";
sha256 = "1fzidq152hnxhg4lj6r2gv4jpnn8yivp27z6q6xy7w6v0dp6bai9";
};
log = pkgs.buildRustCrate {
pname = "log";
version = "0.4.11";
crateName = "log";
sha256 = "0m6xhqxsps5mgd7r91g5mqkndbh8zbjd58p7w75r330zl4n40l07";
dependencies = [ cfg-if ];
};
serde_derive = pkgs.buildRustCrate {
pname = "serde";
crateName = "serde";
version = "1.0.123";
sha256 = "05xl2s1vpf3p7fi2yc9qlzw88d5ap0z3qmhmd7axa6pp9pn1s5xc";
};
serde = pkgs.buildRustCrate {
pname = "serde";
crateName = "serde";
version = "1.0.123";
sha256 = "05xl2s1vpf3p7fi2yc9qlzw88d5ap0z3qmhmd7axa6pp9pn1s5xc";
features = [ "std" ];
};
mustache = pkgs.buildRustCrate {
pname = "mustache";
version = "0.9.0";
crateName = "mustache";
sha256 = "1zgl8l15i19lzp90icgwyi6zqdd31b9vm8w129f41d1zd0hs7ayq";
dependencies = [ log serde ];
};
netencode-mustache = imports.writers.rustSimple { netencode-mustache = imports.writers.rustSimple {
name = "netencode_mustache"; name = "netencode_mustache";
dependencies = [ dependencies = [
depot.users.Profpatsch.arglib.netencode.rust depot.users.Profpatsch.arglib.netencode.rust
netencode-rs netencode-rs
mustache depot.third_party.rust-crates.mustache
]; ];
} (builtins.readFile ./netencode-mustache.rs); } (builtins.readFile ./netencode-mustache.rs);

View file

@ -5,8 +5,8 @@ let
read-http = depot.users.Profpatsch.writers.rustSimple { read-http = depot.users.Profpatsch.writers.rustSimple {
name = "read-http"; name = "read-http";
dependencies = [ dependencies = [
depot.users.Profpatsch.rust-crates.ascii depot.third_party.rust-crates.ascii
depot.users.Profpatsch.rust-crates.httparse depot.third_party.rust-crates.httparse
depot.users.Profpatsch.netencode.netencode-rs depot.users.Profpatsch.netencode.netencode-rs
depot.users.Profpatsch.arglib.netencode.rust depot.users.Profpatsch.arglib.netencode.rust
depot.users.Profpatsch.execline.exec-helpers depot.users.Profpatsch.execline.exec-helpers

View file

@ -8,7 +8,7 @@ let
print-ast = depot.users.Profpatsch.writers.rustSimple { print-ast = depot.users.Profpatsch.writers.rustSimple {
name = "print-ast"; name = "print-ast";
dependencies = with depot.users.Profpatsch.rust-crates; [ dependencies = with depot.third_party.rust-crates; [
libloading libloading
tree-sitter tree-sitter
]; ];
@ -61,7 +61,7 @@ let
watch-file-modified = depot.users.Profpatsch.writers.rustSimple { watch-file-modified = depot.users.Profpatsch.writers.rustSimple {
name = "watch-file-modified"; name = "watch-file-modified";
dependencies = [ dependencies = [
depot.users.Profpatsch.rust-crates.inotify depot.third_party.rust-crates.inotify
depot.users.Profpatsch.netstring.rust-netstring depot.users.Profpatsch.netstring.rust-netstring
]; ];
} '' } ''

View file

@ -4,46 +4,11 @@ let
inherit (depot.users.Profpatsch.writers) inherit (depot.users.Profpatsch.writers)
rustSimpleBin rustSimpleBin
; ;
inherit (pkgs)
buildRustCrate
;
serde = buildRustCrate {
pname = "serde";
crateName = "serde";
version = "1.0.123";
sha256 = "05xl2s1vpf3p7fi2yc9qlzw88d5ap0z3qmhmd7axa6pp9pn1s5xc";
features = [ "std" ];
};
ryu = buildRustCrate {
pname = "ryu";
version = "1.0.5";
crateName = "ryu";
sha256 = "060y2ln1csix593ingwxr2y3wl236ls0ly1ffkv39h5im7xydhrc";
};
itoa = buildRustCrate {
pname = "itoa";
version = "0.4.7";
crateName = "itoa";
sha256 = "0079jlkcmcaw37wljrvb6r3dqq15nfahkqnl5npvlpdvkg31k11x";
};
serde_json = buildRustCrate {
pname = "serde_json";
version = "1.0.62";
crateName = "serde_json";
sha256 = "0sgc8dycigq0nxr4j613m4q733alfb2i10s6nz80lsbbqgrka21q";
dependencies = [ serde ryu itoa ];
features = [ "std" ];
edition = "2018";
};
in in
rustSimpleBin { rustSimpleBin {
name = "nint"; name = "nint";
dependencies = [ serde_json ]; dependencies = [
depot.third_party.rust-crates.serde_json
];
} (builtins.readFile ./nint.rs) } (builtins.readFile ./nint.rs)