chore: reformat
This commit is contained in:
31
flake.nix
31
flake.nix
@ -10,9 +10,13 @@
|
|||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, rust-overlay, flake-utils }:
|
outputs = {
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
self,
|
||||||
let
|
nixpkgs,
|
||||||
|
rust-overlay,
|
||||||
|
flake-utils,
|
||||||
|
}:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system: let
|
||||||
overlays = [(import rust-overlay)];
|
overlays = [(import rust-overlay)];
|
||||||
pkgs = import nixpkgs {inherit system overlays;};
|
pkgs = import nixpkgs {inherit system overlays;};
|
||||||
isLinux = pkgs.lib.hasInfix "linux" system;
|
isLinux = pkgs.lib.hasInfix "linux" system;
|
||||||
@ -21,13 +25,14 @@
|
|||||||
extensions = ["rust-src" "clippy" "rustfmt"];
|
extensions = ["rust-src" "clippy" "rustfmt"];
|
||||||
targets = pkgs.lib.optionals isLinux ["x86_64-unknown-linux-musl"];
|
targets = pkgs.lib.optionals isLinux ["x86_64-unknown-linux-musl"];
|
||||||
};
|
};
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
devShells.default = pkgs.mkShell ({
|
devShells.default = pkgs.mkShell ({
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs =
|
||||||
|
[
|
||||||
rustToolchain
|
rustToolchain
|
||||||
pkgs.pkg-config
|
pkgs.pkg-config
|
||||||
] ++ pkgs.lib.optionals isLinux [
|
]
|
||||||
|
++ pkgs.lib.optionals isLinux [
|
||||||
# Provide cc (gcc) for building proc-macro / build-script crates
|
# Provide cc (gcc) for building proc-macro / build-script crates
|
||||||
# that target the host (x86_64-unknown-linux-gnu).
|
# that target the host (x86_64-unknown-linux-gnu).
|
||||||
pkgs.gcc
|
pkgs.gcc
|
||||||
@ -36,20 +41,20 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
RUST_BACKTRACE = "1";
|
RUST_BACKTRACE = "1";
|
||||||
} // pkgs.lib.optionalAttrs isLinux {
|
}
|
||||||
|
// pkgs.lib.optionalAttrs isLinux {
|
||||||
# Tell Cargo which linker to use for each target so it never
|
# Tell Cargo which linker to use for each target so it never
|
||||||
# falls back to rust-lld (which can't find glibc on NixOS).
|
# falls back to rust-lld (which can't find glibc on NixOS).
|
||||||
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER =
|
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER = "${pkgs.gcc}/bin/gcc";
|
||||||
"${pkgs.gcc}/bin/gcc";
|
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER = "${pkgs.pkgsMusl.stdenv.cc}/bin/cc";
|
||||||
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER =
|
|
||||||
"${pkgs.pkgsMusl.stdenv.cc}/bin/cc";
|
|
||||||
|
|
||||||
# Default build target: static musl binary.
|
# Default build target: static musl binary.
|
||||||
CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl";
|
CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl";
|
||||||
});
|
});
|
||||||
|
|
||||||
packages.default =
|
packages.default =
|
||||||
if isLinux then
|
if isLinux
|
||||||
|
then
|
||||||
(pkgs.pkgsMusl.makeRustPlatform {
|
(pkgs.pkgsMusl.makeRustPlatform {
|
||||||
cargo = rustToolchain;
|
cargo = rustToolchain;
|
||||||
rustc = rustToolchain;
|
rustc = rustToolchain;
|
||||||
|
|||||||
Reference in New Issue
Block a user