axum-controller/flake.nix
2025-03-04 14:26:04 +01:00

94 lines
2.4 KiB
Nix

{
description = "A Nix-flake-based Rust development environment";
nixConfig = {
extra-substituters = [
"https://nixcache.vlt81.de"
"https://cuda-maintainers.cachix.org"
];
extra-trusted-public-keys = [
"nixcache.vlt81.de:nw0FfUpePtL6P3IMNT9X6oln0Wg9REZINtkkI9SisqQ="
];
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
flake-parts.url = "github:hercules-ci/flake-parts";
devshell.url = "github:numtide/devshell";
};
outputs =
{ self
, nixpkgs
, rust-overlay
, flake-utils
, devshell
, ...
}:
flake-utils.lib.eachDefaultSystem
(system:
let
overlays = [
rust-overlay.overlays.default
devshell.overlays.default
(final: prev: {
customRustToolchain = prev.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
})
];
pkgs = import nixpkgs {
inherit system overlays;
config = {
allowUnfree = true;
};
};
buildInputs = with pkgs; [
zlib
clang
libclang
gzip
coreutils
gdb
glib
glibc
];
in
{
apps.devshell = self.outputs.devShells.${system}.default.flakeApp;
devShells.default = pkgs.mkShell {
packages = with pkgs;
[
customRustToolchain
bacon
binaryen
cacert
cargo-bloat
cargo-docset
cargo-machete
cargo-limit
cargo-deny
cargo-edit
cargo-watch
cargo-make
cargo-generate
cargo-udeps
cargo-outdated
cargo-release
calc
fish
inotify-tools
mold
pkg-config
sccache
unzip
]
++ buildInputs;
buildInputs = buildInputs;
shellHook = ''
# export NIX_LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath buildInputs}:$NIX_LD_LIBRARY_PATH
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath buildInputs}"
export MALLOC_CONF=thp:always,metadata_thp:always
'';
};
});
}