-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
56 lines (51 loc) · 1.96 KB
/
flake.nix
File metadata and controls
56 lines (51 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{
description = "Rust project with musl target";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ];
targets = [ "x86_64-unknown-linux-musl" ];
};
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
bashInteractive
rustToolchain
pkg-config
pkgsStatic.stdenv.cc
gh
cargo-edit
];
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER = "${pkgs.pkgsStatic.stdenv.cc}/bin/${pkgs.pkgsStatic.stdenv.cc.targetPrefix}cc";
CC_x86_64_unknown_linux_musl = "${pkgs.pkgsStatic.stdenv.cc}/bin/${pkgs.pkgsStatic.stdenv.cc.targetPrefix}cc";
# Automatically configure Git hooks for code quality
shellHook = ''
# Set up Git hooks if not already configured
if [ -d .git ] && [ -d .githooks ]; then
current_hooks_path=$(git config core.hooksPath || echo "")
if [ "$current_hooks_path" != ".githooks" ]; then
echo "📎 Setting up Git hooks for code quality checks..."
git config core.hooksPath .githooks
echo "✅ Git hooks configured automatically!"
echo " • pre-commit: Checks code formatting"
echo " • pre-push: Runs formatting and clippy checks"
echo ""
echo "To disable: git config --unset core.hooksPath"
fi
fi
'';
};
}
);
}