-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
59 lines (49 loc) · 1.5 KB
/
shell.nix
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
57
58
59
{pkgs ? import <nixpkgs> {}}:
pkgs.mkShell {
inputsFrom = [(pkgs.callPackage ./default.nix {})];
buildInputs = with pkgs; [
rust-analyzer
rustfmt
crate2nix
clippy
surrealdb
surrealist
surrealdb-migrations
(writeScriptBin "helpme" ''
__usage="
👋 Welcome to WeddingAPI development environment. 🚀
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 development server
- apply-env: apply environment variable to current shell
- helpme: show this messages
Repository:
- https://github.com/maulanasdqn/wedding-api
[Info]===============================================================>
"
echo "$__usage"
'')
(writeScriptBin "dev" ''
cargo watch -x "run -p api"
'')
(writeScriptBin "start" ''
echo "Starting project in production mode..."
./result/bin/api
'')
(writeScriptBin "build" ''
nix build -f Cargo.nix
'')
(writeScriptBin "apply-env" ''
export $(cat .env | xargs)
'')
];
shellHook = ''
helpme
'';
}