Skip to content

Commit a0ff87d

Browse files
committed
Add Nix development environment and improve documentation
- Added flake.nix for optional Nix development environment with devshell - Expanded README.md with comprehensive project documentation - Removed legacy .ruby-version file (project now uses Node.js) - Added Nix development environment section to README.md as an optional method The Nix flake provides a consistent development environment with: - Node.js 22 and Yarn package manager - Convenient commands (dev, build, start, install-deps) - Automatic PATH setup and dependency installation
1 parent c8501f6 commit a0ff87d

4 files changed

Lines changed: 220 additions & 1 deletion

File tree

.ruby-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,94 @@
11
# Utensils.io
22

33
The home of [Utensils.io](https://utensils.io).
4+
5+
## Project Overview
6+
7+
This is a [Next.js](https://nextjs.org/) project that generates a static website for Utensils.io. The site uses TailwindCSS for styling to create a modern, responsive design.
8+
9+
## Development Requirements
10+
11+
- Node.js version 22
12+
- Yarn package manager (version 1.22.22+ recommended)
13+
14+
## Getting Started
15+
16+
1. Clone the repository
17+
2. Install dependencies:
18+
```shell
19+
yarn install --frozen-lockfile
20+
```
21+
3. Start the development server:
22+
```shell
23+
yarn dev
24+
```
25+
4. Open [http://localhost:3000](http://localhost:3000) in your browser to see the result
26+
27+
### Nix Development Environment (Optional)
28+
29+
If you have [Nix](https://nixos.org/) installed with flakes enabled, you can use the provided development environment:
30+
31+
```shell
32+
nix develop
33+
```
34+
35+
This will set up a shell with all the required dependencies and provide convenient commands:
36+
- `dev` - Start the development server
37+
- `build` - Build the site for production
38+
- `start` - Start the production server
39+
- `install-deps` - Install dependencies
40+
41+
## Available Scripts
42+
43+
- `yarn dev` - Starts the development server
44+
- `yarn build` - Builds the application for production
45+
- `yarn start` - Serves the static output directory using the 'serve' package
46+
- `yarn export` - Alias for `yarn build` (builds the static site)
47+
48+
## Project Structure
49+
50+
- `_articles/` - Markdown files for blog articles
51+
- `components/` - React components
52+
- `lib/` - Utility functions and constants
53+
- `pages/` - Next.js pages
54+
- `public/` - Static assets
55+
- `styles/` - CSS styles
56+
57+
## Adding Content
58+
59+
Articles are written in Markdown format and stored in the `_articles/` directory. Each article should include frontmatter with the following fields:
60+
61+
```markdown
62+
---
63+
title: 'Article Title'
64+
excerpt: 'Brief description of the article'
65+
date: 'YYYY-MM-DD'
66+
slug: 'article-slug'
67+
authors:
68+
- name: Author Name
69+
github: https://github.com/username
70+
tags:
71+
- 'Tag1'
72+
- 'Tag2'
73+
---
74+
75+
Article content goes here...
76+
```
77+
78+
## Deployment
79+
80+
The site is automatically deployed to GitHub Pages when changes are pushed to the main branch. The deployment process is handled by a GitHub Actions workflow defined in `.github/workflows/deploy.yml`.
81+
82+
The workflow:
83+
1. Checks out the code
84+
2. Sets up Node.js
85+
3. Installs dependencies with Yarn
86+
4. Builds and exports the static site
87+
5. Copies the CNAME file to the output directory
88+
6. Deploys to GitHub Pages
89+
90+
## Technologies
91+
92+
- [Next.js](https://nextjs.org/) - React framework
93+
- [TailwindCSS](https://tailwindcss.com/) - Utility-first CSS framework
94+
- [Remark](https://github.com/remarkjs/remark) - Markdown processor

flake.lock

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
description = "Utensils.io website development environment";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
devshell.url = "github:numtide/devshell";
7+
devshell.inputs.nixpkgs.follows = "nixpkgs";
8+
};
9+
10+
outputs = { self, nixpkgs, devshell, ... }:
11+
{
12+
devShells = nixpkgs.lib.genAttrs [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ] (
13+
system:
14+
let
15+
pkgs = import nixpkgs {
16+
inherit system;
17+
overlays = [ devshell.overlays.default ];
18+
config = {
19+
allowUnfree = true;
20+
};
21+
};
22+
in
23+
{
24+
default = pkgs.devshell.mkShell {
25+
name = "utensils-website";
26+
27+
packages = with pkgs; [
28+
nodejs_22
29+
yarn
30+
];
31+
32+
# No environment variables needed
33+
env = [];
34+
35+
# Define commands that will be available in the devshell
36+
commands = [
37+
{
38+
name = "dev";
39+
help = "Start the development server";
40+
command = "yarn dev";
41+
}
42+
{
43+
name = "build";
44+
help = "Build the site for production";
45+
command = "yarn build";
46+
}
47+
{
48+
name = "start";
49+
help = "Start the production server";
50+
command = "yarn start";
51+
}
52+
{
53+
name = "install-deps";
54+
help = "Install dependencies";
55+
command = "yarn install --frozen-lockfile";
56+
}
57+
];
58+
59+
# Add node_modules/.bin to PATH
60+
devshell.startup.nodejs-bin-in-path = {
61+
text = ''
62+
export PATH="$PWD/node_modules/.bin:$PATH"
63+
'';
64+
deps = [];
65+
};
66+
67+
# Auto-install dependencies if needed
68+
devshell.startup.install-deps = {
69+
text = ''
70+
if [ ! -d "node_modules" ]; then
71+
echo "Installing dependencies..."
72+
yarn install --frozen-lockfile
73+
fi
74+
'';
75+
deps = [];
76+
};
77+
};
78+
}
79+
);
80+
};
81+
}

0 commit comments

Comments
 (0)