chore: reformat

This commit is contained in:
Edward Langley
2026-03-30 22:28:45 -07:00
parent f19f503ab1
commit 856b5d5d41

105
flake.nix
View File

@ -10,64 +10,69 @@
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,
overlays = [ (import rust-overlay) ]; rust-overlay,
pkgs = import nixpkgs { inherit system overlays; }; flake-utils,
isLinux = pkgs.lib.hasInfix "linux" system; }:
flake-utils.lib.eachDefaultSystem (system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {inherit system overlays;};
isLinux = pkgs.lib.hasInfix "linux" system;
rustToolchain = pkgs.rust-bin.stable.latest.default.override { rustToolchain = pkgs.rust-bin.stable.latest.default.override {
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 [ ]
# Provide cc (gcc) for building proc-macro / build-script crates ++ pkgs.lib.optionals isLinux [
# that target the host (x86_64-unknown-linux-gnu). # Provide cc (gcc) for building proc-macro / build-script crates
pkgs.gcc # that target the host (x86_64-unknown-linux-gnu).
# musl-gcc wrapper for the static musl target. pkgs.gcc
pkgs.pkgsMusl.stdenv.cc # musl-gcc wrapper for the static musl target.
]; pkgs.pkgsMusl.stdenv.cc
];
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
(pkgs.pkgsMusl.makeRustPlatform { then
cargo = rustToolchain; (pkgs.pkgsMusl.makeRustPlatform {
rustc = rustToolchain; cargo = rustToolchain;
}).buildRustPackage { rustc = rustToolchain;
pname = "improvise"; }).buildRustPackage {
version = "0.1.0"; pname = "improvise";
src = ./.; version = "0.1.0";
cargoLock.lockFile = ./Cargo.lock; src = ./.;
} cargoLock.lockFile = ./Cargo.lock;
else }
(pkgs.makeRustPlatform { else
cargo = rustToolchain; (pkgs.makeRustPlatform {
rustc = rustToolchain; cargo = rustToolchain;
}).buildRustPackage { rustc = rustToolchain;
pname = "improvise"; }).buildRustPackage {
version = "0.1.0"; pname = "improvise";
src = ./.; version = "0.1.0";
cargoLock.lockFile = ./Cargo.lock; src = ./.;
}; cargoLock.lockFile = ./Cargo.lock;
}); };
});
} }