diff --git a/.cargo/config.toml b/.cargo/config.toml index 5903a40..7f193ac 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -4,7 +4,3 @@ xtask = "run --package xtask --quiet --" [profile.dev] debug = 0 strip = "debuginfo" - -[target.x86_64-unknown-linux-gnu] -linker = "clang" -rustflags = ["-C", "link-arg=-fuse-ld=mold", "-C", "target-cpu=native"] diff --git a/Cargo.lock b/Cargo.lock index 8885015..329f716 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1161,6 +1161,7 @@ dependencies = [ "clap", "dropshot", "http", + "openssl", "schemars", "serde", "slog", @@ -1905,6 +1906,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "openssl-src" +version = "300.4.1+3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faa4eac4138c62414b5622d1b31c5c304f34b406b013c079c2bbc652fdd6678c" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" version = "0.9.104" @@ -1913,6 +1923,7 @@ checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] diff --git a/flake.nix b/flake.nix index 55cd00f..c47f31d 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,9 @@ "rust-analyzer" "rust-src" ]; + targets = [ + "x86_64-unknown-linux-gnu" + ]; }; }) ]; @@ -64,13 +67,14 @@ nativeBuildInputs = with pkgs; [ clang + glibc.static mold-wrapped pkg-config ]; - buildInputs = with pkgs; [ - openssl - ]; + # CARGO_BUILD_TARGET = "x86_64-unknown-linux-gnu"; + # CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static"; + # OPENSSL_STATIC = "true"; }; buildCrate = @@ -176,8 +180,7 @@ sqls sqlx-cli watchexec - ] - ++ commonArgs.buildInputs; + ]; RUST_BACKTRACE = 1; RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc; # Required for rust-analyzer }; diff --git a/hostd/Cargo.toml b/hostd/Cargo.toml index f3322c7..fa91683 100644 --- a/hostd/Cargo.toml +++ b/hostd/Cargo.toml @@ -21,3 +21,4 @@ serde.workspace = true http.workspace = true zbus_systemd = { version = "0.25701.0", features = ["hostname1", "sysupdate1", "network1", "portable1", "resolve1", "systemd1"] } zbus = "5.4.0" +openssl = { version = "0.10.63", features = ["vendored"] }