Skip to content

Commit 6c5b4c3

Browse files
committed
flake tweak
1 parent 1470f2d commit 6c5b4c3

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

flake.nix

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@
2727
rustc = rust;
2828
};
2929

30+
# Rust with musl target for static builds on Linux
31+
rustWithMusl = pkgs.rust-bin.stable.latest.default.override {
32+
extensions = ["rust-src"];
33+
targets = ["x86_64-unknown-linux-musl"];
34+
};
35+
36+
rustPlatformMusl = pkgs.makeRustPlatform {
37+
cargo = rustWithMusl;
38+
rustc = rustWithMusl;
39+
};
40+
3041
manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
3142
in {
3243
# `nix develop`.
@@ -75,7 +86,7 @@
7586
};
7687

7788
# Static musl build for Linux distribution
78-
anonymiser-musl = rustPlatform.buildRustPackage {
89+
anonymiser-musl = rustPlatformMusl.buildRustPackage {
7990
pname = "${manifest.name}-musl";
8091
version = manifest.version;
8192
src = pkgs.nix-gitignore.gitignoreSource [] ./.;
@@ -92,7 +103,7 @@
92103
perl # Required for vendored OpenSSL build
93104
];
94105

95-
# With vendored OpenSSL, we don't need runtime dependencies
106+
# With vendored OpenSSL and static linking, we don't need runtime dependencies
96107
buildInputs = [];
97108

98109
checkFlags = [

0 commit comments

Comments
 (0)