chore: improve Nix flake

This commit is contained in:
Marc Plano-Lesay 2025-08-01 11:35:27 +10:00
parent e9231986c3
commit 7836888456
Signed by: kernald
GPG key ID: 66A41B08CC62A6CF
6 changed files with 208 additions and 20 deletions

36
nix/shell.nix Normal file
View file

@ -0,0 +1,36 @@
{ pkgs, rust-toolchain, self, ... }:
{
default = pkgs.mkShell {
name = "immich-tools";
buildInputs = with pkgs; [
cargo
cargo-edit
cargo-insta
cargo-machete
cargo-release
cargo-sort
git-cliff
openssl
pkg-config
rustc
rust-toolchain
] ++ lib.optionals stdenv.isDarwin [
libiconv
] ++ self.checks.${pkgs.system}.pre-commit-check.enabledPackages;
RUST_BACKTRACE = 1;
# Copy rust-toolchain to project directory for easy use in IntelliJ
shellHook = ''
if [ -L ./.rust-toolchain ] && [ "$(readlink ./.rust-toolchain)" = "${rust-toolchain}" ]; then
echo "Rust toolchain symlink is already correct."
else
rm -f ./.rust-toolchain
ln -s ${rust-toolchain} ./.rust-toolchain
echo "Rust toolchain symlink updated."
fi
${self.checks.${pkgs.system}.pre-commit-check.shellHook}
'';
};
}