Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Direnv configuration for automatic shell activation
# Install direnv: nix profile install nixpkgs#direnv
# Then run: direnv allow

if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSqjKdZqGQ3g/3p3g/dh99fQ="
fi

use flake

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# nix
result
result-*
.direnv/
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ I. I. ## Table of Contents
- [Local Deployment](#local-deployment)

---!
Welcome to TripSit's Main Website, brought to you by THC.
Welcome to TripSit's Main Website, Harm Reduction Through Education.

This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

Expand All @@ -39,10 +39,10 @@ The preferred way to have full control (and perhaps more resources) is local dev
1) Git clone the repo
2) Install dependencies with `npm install`

---
> [!WARNKNG]

> [!WARNING]
> WINDOWS USERS MIGHT HAVE TO ADJUST DEPENDENCIES LOCALLY AS WITH TRY INSTALLING NVM THROUGH WINGET > IF PROBLEMS OCCUR
---

Then you have two choices:

#### Docker Deployment
Expand All @@ -65,4 +65,4 @@ If you cannot run docker for whatever reason, or you're in codespace.


But it worked on my system (tm) when im running on an ubuntu vps, so give it a shot.
Also now works on windows as of 2/1/2025 on my machine (tm), if fails try WSL first before NVM
Also now works on windows as of 2/1/2025 on my machine (tm), if fails try WSL first before NVM
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 89 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
description = "Development environment for website project";

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

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
nodejs = pkgs.nodejs_22;
devTools = with pkgs; [
nodejs
nodePackages.npm
nodePackages.typescript
docker
docker-compose
postgresql_16
pgadmin4
neovim
git
curl
wget
bashInteractive
coreutils
];
in
{
devShells.default = pkgs.mkShell {
buildInputs = devTools;

# Isolated environment - only packages from this flake are available
# Uncomment to make the shell pure (no access to system packages (FOR NIX USERS)
# pure = true;

shellHook = ''
echo "🚀 Website Development Environment"
echo "Node.js version: $(node --version)"
echo "npm version: $(npm --version)"
echo "Neovim version: $(nvim --version | head -n1)"
echo "Docker version: $(docker --version 2>/dev/null || echo 'Docker daemon not running')"
echo "PostgreSQL version: $(postgres --version 2>/dev/null || echo 'PostgreSQL not started')"
echo ""
echo "Available commands:"
echo " npm install - Install dependencies"
echo " npm run dev - Start development server"
echo " npm run lint - Run linter"
echo " npm run website - Build and run Docker container"
echo " npm run logs - View Docker container logs"
echo ""
echo "Database commands:"
echo " pg_ctl start - Start PostgreSQL server"
echo " pg_ctl stop - Stop PostgreSQL server"
echo " pgadmin4 - Launch pgAdmin web interface"
echo ""
echo "💡 Tip: Run 'check-nix-env' to verify you're in the Nix environment"
echo ""

# Helper function to check if in Nix environment
check-nix-env() {
if [ -n "$IN_NIX_SHELL" ]; then
echo "You ARE in the Nix development environment"
echo " IN_NIX_SHELL=$IN_NIX_SHELL"
else
echo "You are NOT in the Nix development environment"
echo " Run 'nix develop' to enter it"
fi
}

# Set NODE_OPTIONS for debugging if needed
export NODE_OPTIONS="--inspect"

# Uncomment the lines below if you want automatic LazyVim setup
# if [ ! -d ~/.config/nvim ]; then
# echo "Setting up LazyVim..."
# git clone https://github.com/LazyVim/starter ~/.config/nvim
# fi
'';

NODE_ENV = "development";
};
}
);
}

Loading