2026-04-02 13:39:52 +07:00
|
|
|
{
|
|
|
|
|
pkgs ? import <nixpkgs> { },
|
|
|
|
|
}:
|
2025-12-01 00:20:42 +07:00
|
|
|
pkgs.mkShell {
|
2026-04-02 13:39:52 +07:00
|
|
|
inputsFrom = [ (pkgs.callPackage ./default.nix { }) ];
|
2025-12-01 00:20:42 +07:00
|
|
|
buildInputs = with pkgs; [
|
|
|
|
|
rust-analyzer
|
|
|
|
|
rustfmt
|
|
|
|
|
crate2nix
|
|
|
|
|
clippy
|
|
|
|
|
postgresql
|
|
|
|
|
|
|
|
|
|
(writeScriptBin "helpme" ''
|
|
|
|
|
__usage="
|
2026-04-02 13:39:52 +07:00
|
|
|
👋 Welcome to IMPHNEN Backend Service development environment. 🚀
|
2025-12-01 00:20:42 +07:00
|
|
|
If you see this message, it means your are inside the Nix shell ❄️.
|
|
|
|
|
|
|
|
|
|
[Info]===============================================================>
|
|
|
|
|
|
|
|
|
|
Rustc Version: v${rustc.version}
|
|
|
|
|
Rustup Version: v${rustup.version}
|
|
|
|
|
Cargo Version: v${cargo.version}
|
|
|
|
|
|
|
|
|
|
Command available:
|
|
|
|
|
- start: start project in production 🛹 ( need to run build first )
|
|
|
|
|
- build: build project for production
|
|
|
|
|
- dev: start project in development
|
|
|
|
|
- start-docker: start project in docker container ( compose )
|
|
|
|
|
- build-docker: build project for docker container
|
|
|
|
|
- helpme: show this messages
|
|
|
|
|
|
|
|
|
|
Repository:
|
|
|
|
|
- https://github.com/IMPHNEN/imphnen-cms-api
|
|
|
|
|
[Info]===============================================================>
|
|
|
|
|
"
|
|
|
|
|
echo "$__usage"
|
|
|
|
|
'')
|
|
|
|
|
|
|
|
|
|
(writeScriptBin "dev" ''
|
|
|
|
|
cargo watch -x run
|
|
|
|
|
'')
|
|
|
|
|
|
|
|
|
|
(writeScriptBin "start" ''
|
|
|
|
|
echo "Starting project in production mode..."
|
|
|
|
|
echo "Najm Course API started on port $PORT 🛹..."
|
|
|
|
|
./result/bin/imphnen-cms-api
|
|
|
|
|
'')
|
|
|
|
|
|
|
|
|
|
(writeScriptBin "build" ''
|
|
|
|
|
echo "Building project..."
|
|
|
|
|
crate2nix generate
|
|
|
|
|
nix build -f Cargo.nix
|
|
|
|
|
echo "Now you can start the project with the command 'start'"
|
|
|
|
|
'')
|
|
|
|
|
|
|
|
|
|
(writeScriptBin "start-docker" ''
|
|
|
|
|
echo "Starting project in docker container..."
|
|
|
|
|
docker compose up -d
|
|
|
|
|
'')
|
|
|
|
|
|
|
|
|
|
(writeScriptBin "build-docker" ''
|
|
|
|
|
echo "Building project with docker..."
|
|
|
|
|
docker build -t imphnen-api:latest .
|
|
|
|
|
echo "Project built successfully."
|
|
|
|
|
echo "Now you can start the project with the command 'start-docker'"
|
|
|
|
|
'')
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
shellHook = ''
|
|
|
|
|
helpme
|
|
|
|
|
if [ -f .env ]; then
|
|
|
|
|
echo "Loading .env file..."
|
|
|
|
|
export $(cat .env | xargs)
|
|
|
|
|
echo "Successfully applied .env file."
|
|
|
|
|
else
|
|
|
|
|
echo ".env file not found."
|
|
|
|
|
fi
|
|
|
|
|
'';
|
|
|
|
|
}
|