-
Notifications
You must be signed in to change notification settings - Fork 7
Added nix dev env compatability making life easier for me (and you too if you use nix) #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Win32Stuxnet
wants to merge
7
commits into
TripSit:main
Choose a base branch
from
Win32Stuxnet:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
262149e
Update README.md
Win32Stuxnet bcf3a56
Merge pull request #1 from Win32Stuxnet/quickfixes
Win32Stuxnet 2d1eb58
Add flake.nix for development environment setup
c39d233
Add Nix flake lock file, update .gitignore for Nix, and add direnv co…
426d9c8
Add check-nix-env helper function to shellHook
09366a7
Refactor check-nix-env output messages for clarity
4cc11ad
Update welcome message for clarity
Win32Stuxnet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,3 +36,8 @@ yarn-error.log* | |
| # typescript | ||
| *.tsbuildinfo | ||
| next-env.d.ts | ||
|
|
||
| # nix | ||
| result | ||
| result-* | ||
| .direnv/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"; | ||
| }; | ||
| } | ||
| ); | ||
| } | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.