forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevenv.nix
More file actions
108 lines (92 loc) · 2.95 KB
/
devenv.nix
File metadata and controls
108 lines (92 loc) · 2.95 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
{ pkgs, lib, config, ... }:
{
# https://devenv.sh/basics/
env = {
NODE_ENV = "dev";
NODE_OPTIONS = "--max-http-header-size=32768";
};
# https://devenv.sh/packages/
packages = with pkgs; [
git
# Optional: Uncomment if you need browser automation
# chromium
];
# https://devenv.sh/languages/
languages.javascript = {
enable = true;
package = pkgs.nodejs_24;
pnpm = {
enable = true;
package = pkgs.pnpm_10;
};
};
# https://devenv.sh/services/
services.redis = {
enable = lib.mkDefault false; # Disabled by default, users can enable in devenv.local.nix
port = 6379;
};
# https://devenv.sh/scripts/
scripts.rsshub-dev.exec = ''
pnpm run dev
'';
scripts.rsshub-build.exec = ''
pnpm run build
'';
scripts.rsshub-start.exec = ''
pnpm start
'';
scripts.rsshub-test.exec = ''
pnpm test
'';
# https://devenv.sh/processes/
processes = {
# Uncomment to auto-start RSSHub in dev mode when entering the shell
# rsshub.exec = "pnpm run dev";
# Example: Auto-start with Redis
# rsshub.exec = "pnpm run dev";
};
# https://devenv.sh/pre-commit-hooks/
pre-commit.hooks = {
# Lint staged files
eslint = {
enable = true;
entry = lib.mkForce "pnpm run format:staged";
};
};
enterShell = ''
echo ""
echo "🚀 RSSHub Development Environment"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Node.js: $(node --version)"
echo "pnpm: $(pnpm --version)"
${lib.optionalString config.services.redis.enable ''
echo "Redis: Running on port ${toString config.services.redis.port}"
''}
echo ""
echo "Available commands:"
echo " rsshub-dev - Start development server (pnpm run dev)"
echo " rsshub-build - Build the project (pnpm run build)"
echo " rsshub-start - Start production server (pnpm start)"
echo " rsshub-test - Run tests (pnpm test)"
${lib.optionalString (!config.services.redis.enable) ''
echo ""
echo "💡 Tip: Enable Redis by creating devenv.local.nix:"
echo " { services.redis.enable = true; }"
''}
echo ""
echo "Documentation: https://docs.rsshub.app"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# Install dependencies if node_modules doesn't exist
if [ ! -d "node_modules" ]; then
echo "📦 Installing dependencies..."
pnpm install
fi
'';
# https://devenv.sh/integrations/dotenv/
dotenv.enable = true; # Automatically load .env file
# Load local overrides if they exist
# Users can create devenv.local.nix for personal customizations
imports = lib.optional (builtins.pathExists ./devenv.local.nix) ./devenv.local.nix;
}