{
  description = "Komp AC - Kompress Accounting";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
      in
      {
        devShells.default = pkgs.mkShell {
          buildInputs = with pkgs; [
            # Rust toolchain
            rustc
            cargo
            rustfmt
            clippy
	    cargo-watch

            # C build tools (for your linker issue)
            gcc
            binutils
            pkg-config
            
            # OpenSSL for crypto dependencies
            openssl
            openssl.dev
            
            # PostgreSQL for sqlx
            postgresql
	    sqlx-cli
            
            # Protocol Buffers compiler for gRPC
            protobuf
          ];

          shellHook = ''
            export PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig:$PKG_CONFIG_PATH"
            export OPENSSL_DIR="${pkgs.openssl.dev}"
            export OPENSSL_LIB_DIR="${pkgs.openssl.out}/lib"
            export OPENSSL_INCLUDE_DIR="${pkgs.openssl.dev}/include"
            echo "🦀 Rust development environment loaded"
            echo "OpenSSL and PostgreSQL available"
          '';
        };
      }
    );
}
