Misc cleanup

This commit is contained in:
Zhaofeng Li 2023-05-22 16:00:34 -06:00
parent cbf329f087
commit 0cd6c9c059
6 changed files with 25 additions and 18 deletions

3
.cargo/config Normal file
View file

@ -0,0 +1,3 @@
# For -Zbuild-std
[target.aarch64-unknown-linux-musl]
rustflags = ["-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc"]

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
.direnv .direnv
result*
/target /target
key.txt key.txt

1
Cargo.lock generated
View file

@ -737,7 +737,6 @@ dependencies = [
"clap", "clap",
"daemonize", "daemonize",
"gha-cache", "gha-cache",
"rand",
"serde", "serde",
"serde_json", "serde_json",
"thiserror", "thiserror",

View file

@ -56,34 +56,39 @@ let
src = nix-gitignore.gitignoreSource [] ./.; src = nix-gitignore.gitignoreSource [] ./.;
buildInputs = with pkgs; [] commonArgs = {
inherit (crateName) pname version;
inherit src;
buildInputs = with pkgs; []
++ lib.optionals pkgs.stdenv.isDarwin [ ++ lib.optionals pkgs.stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security darwin.apple_sdk.frameworks.Security
]; ];
# The Rust toolchain from rust-overlay has a dynamic libiconv in depsTargetTargetPropagated nativeBuildInputs = with pkgs; []
# Our static libiconv needs to take precedence # The Rust toolchain from rust-overlay has a dynamic libiconv in depsTargetTargetPropagated
nativeBuildInputs = with pkgs; [] # Our static libiconv needs to take precedence
++ lib.optionals pkgs.stdenv.isDarwin [ ++ lib.optionals pkgs.stdenv.isDarwin [
(libiconv.override { enableStatic = true; enableShared = false; }) (libiconv.override { enableStatic = true; enableShared = false; })
]; ];
cargoExtraArgs = "--target ${crossPlatform.rustTargetSpec}"; cargoExtraArgs = "--target ${crossPlatform.rustTargetSpec}";
cargoArtifacts = craneLib.buildDepsOnly ({ cargoVendorDir = craneLib.vendorMultipleCargoDeps {
inherit (crateName) pname version; inherit (craneLib.findCargoFiles src) cargoConfigs;
inherit src buildInputs nativeBuildInputs cargoExtraArgs; cargoLockList = [
./Cargo.lock
"${rustNightly.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/Cargo.lock"
];
};
} // crossPlatform.env;
doCheck = false; crate = craneLib.buildPackage (commonArgs // {
} // crossPlatform.env); cargoArtifacts = craneLib.buildDepsOnly commonArgs;
crate = craneLib.buildPackage ({
inherit (crateName) pname version;
inherit src buildInputs nativeBuildInputs cargoExtraArgs;
inherit cargoArtifacts;
# The resulting executable must be standalone # The resulting executable must be standalone
allowedRequisites = []; allowedRequisites = [];
} // crossPlatform.env); });
in crate; in crate;
in { in {
inherit crossPlatforms cargoTargets cargoCrossEnvs; inherit crossPlatforms cargoTargets cargoCrossEnvs;

View file

@ -19,7 +19,6 @@ serde_json = "1.0.96"
thiserror = "1.0.40" thiserror = "1.0.40"
tokio-stream = "0.1.14" tokio-stream = "0.1.14"
tokio-util = { version = "0.7.8", features = ["io"] } tokio-util = { version = "0.7.8", features = ["io"] }
rand = "0.8.5"
daemonize = "0.5.0" daemonize = "0.5.0"
[dependencies.tokio] [dependencies.tokio]

View file

@ -4,7 +4,7 @@
use std::net::SocketAddr; use std::net::SocketAddr;
use axum::{extract::Extension, routing::post, http::uri::Uri, Json, Router}; use axum::{extract::Extension, http::uri::Uri, routing::post, Json, Router};
use axum_macros::debug_handler; use axum_macros::debug_handler;
use serde::Serialize; use serde::Serialize;