-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
67 lines (59 loc) · 1.9 KB
/
flake.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
60
61
62
63
64
65
66
67
{
description = "Next.js development environment with Podman";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
# Systems support
systems.url = "github:nix-systems/default";
};
outputs = { self, nixpkgs, systems, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# Core dependencies
nodejs_20
nodePackages.typescript
podman
podman-compose
direnv
git
];
shellHook = ''
# Preserve existing zsh configuration
export ZDOTDIR="$HOME"
export ZSH="$HOME/.oh-my-zsh"
# Use zsh as the shell while preserving oh-my-zsh
if [ -n "$ZSH_VERSION" ]; then
# We're already in zsh
source "$ZSH/oh-my-zsh.sh" 2>/dev/null || true
else
# Start zsh
exec zsh
fi
echo "🚀 Next.js development environment activated"
# Ensure podman socket is running
if ! podman system service --time=0 >/dev/null 2>&1; then
echo "Starting podman socket..."
podman system service --time=0 >/dev/null 2>&1 &
fi
# Environment variables for podman
export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/podman/podman.sock"
export DOCKER_CONTEXT="default"
# Load .env file if it exists
if [ -f .env ]; then
set -a
source .env
set +a
fi
'';
# Add environment variables
env = {
NODE_ENV = "production";
};
};
});
}