Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 16 additions & 0 deletions .copier-answers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: bfd93fa
_src_path: ./
accountname: quickplates
appname: next-example
description: Next.js app example ⚫
docs: true
docsurl: https://quickplates.github.io/next-example
envprefix: NEXT_EXAMPLE
imagename: apps/next-example
keyprefix: next-example
port: 3000
registry: true
releases: true
reponame: next-example
repourl: https://github.com/quickplates/next-example
76 changes: 76 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"build": {
"context": "image/",
"dockerfile": "image/Dockerfile",
"options": ["--network=host"]
},
"customizations": {
"vscode": {
"extensions": [
"jnoortheen.nix-ide",
"mkhl.direnv",
"task.vscode-task",
"Trunk.io",
"vunguyentuan.vscode-css-variables",
"vunguyentuan.vscode-postcss"
],
"settings": {
"[nix]": {
"editor.defaultFormatter": "jnoortheen.nix-ide"
},
"cssVariables.languages": ["css", "scss", "postcss"],
"cssVariables.lookupFiles": [
"**/*.css",
"**/*.sass",
"**/*.scss",
"node_modules/@mantine/core/styles.css"
],
"editor.defaultFormatter": "trunk.io",
"nix.enableLanguageServer": true,
"nix.serverPath": "nil",
"nix.serverSettings": {
"nil": {
"formatting": {
"command": ["nix", "fmt", "--", "-"]
}
}
},
"remote.autoForwardPorts": false
}
}
},
"features": {
"ghcr.io/devcontainers-extra/features/direnv:1.0.3": {
"version": "2.37.1"
},
"ghcr.io/devcontainers-extra/features/starship:1.0.10": {
"version": "1.24.0"
},
"ghcr.io/devcontainers/features/docker-in-docker:2.12.4": {
"version": "28.5.1"
},
"ghcr.io/devcontainers/features/nix:1.2.0": {
"extraNixConfig": "experimental-features = nix-command flakes",
"version": "2.28.5"
}
},
"mounts": [
"source=devcontainer-shared-secrets,target=/secrets/,type=volume",
"source=devcontainer-${devcontainerId}-nix,target=/nix/,type=volume",
"source=devcontainer-${devcontainerId}-shellhistory-persist,target=/persist/shellhistory/,type=volume",
"source=devcontainer-shared-trunk-cache,target=/cache/trunk/,type=volume",
"source=devcontainer-shared-npm-cache,target=/cache/npm/,type=volume"
],
"onCreateCommand": "/hooks/create.sh",
"remoteEnv": {
"WORKSPACE": "${containerWorkspaceFolder}"
},
"runArgs": [
"--uts=host",
"--ipc=host",
"--network=host",
"--userns=host",
"--cgroupns=host",
"--privileged"
]
}
17 changes: 17 additions & 0 deletions .devcontainer/image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Using one of the offical dev container images as base
# Going with Ubuntu, because it has glibc, which some tools might need
# It also has git, zsh and a bunch of other stuff preinstalled
# Also, it includes a non-root 'vscode' user with sudo access
# The version is pinned to ensure reproducibility
FROM mcr.microsoft.com/devcontainers/base:1.2.6-ubuntu-24.04

ENV REMOTE_USER=vscode

# Setup script
COPY setup.sh /tmp/setup.sh

RUN /tmp/setup.sh && \
rm /tmp/setup.sh

# Lifecycle hooks
COPY hooks/ /hooks/
26 changes: 26 additions & 0 deletions .devcontainer/image/hooks/create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

# Create shell history cache files if they don't exist for some reason
touch /persist/shellhistory/.bash_history
touch /persist/shellhistory/.zsh_history

# Use GitHub token secret if it exists
if [[ -s /secrets/.ghtoken && -r /secrets/.ghtoken ]]; then
token="$(cat /secrets/.ghtoken)"
confighome="${XDG_CONFIG_HOME:-${HOME}/.config/}"

# Add GitHub token to Nix config
configfile="${confighome}/nix/nix.conf"
tmpfile="$(mktemp)"

mkdir --parents "$(dirname "${configfile}")"
touch "${configfile}"

if grep --quiet extra-access-tokens "${configfile}"; then
sed "s|extra-access-tokens.*|extra-access-tokens = github.com=${token}|" "${configfile}" >"${tmpfile}"
cat "${tmpfile}" >"${configfile}"
rm "${tmpfile}"
else
echo "extra-access-tokens = github.com=${token}" >>"${configfile}"
fi
fi
73 changes: 73 additions & 0 deletions .devcontainer/image/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env bash

REMOTE_USER="${REMOTE_USER:?}"
REMOTE_USER_PASSWD="$(getent passwd "${REMOTE_USER}")"
REMOTE_USER_HOME="$(echo "${REMOTE_USER_PASSWD}" | cut --delimiter ':' --fields 6)"

# Setup default shell
chsh --shell /usr/bin/zsh "${REMOTE_USER}"

# Setup direnv
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
eval "\$(direnv hook bash)"
EOF

cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
eval "\$(direnv hook zsh)"
EOF

# Setup starship
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
eval "\$(starship init bash)"
EOF

cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
eval "\$(starship init zsh)"
EOF

# Setup secrets directory
mkdir --parents /secrets/

chown --recursive "${REMOTE_USER}:" /secrets/

# Setup shell history cache
mkdir --parents /persist/shellhistory/

touch /persist/shellhistory/.bash_history
touch /persist/shellhistory/.zsh_history

chown --recursive "${REMOTE_USER}:" /persist/shellhistory/

cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
export HISTFILE=/persist/shellhistory/.bash_history
EOF

cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
export HISTFILE=/persist/shellhistory/.zsh_history
EOF

# Setup trunk cache
mkdir --parents /cache/trunk/

chown --recursive "${REMOTE_USER}:" /cache/trunk/

cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
export TRUNK_CACHE=/cache/trunk/
EOF

cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
export TRUNK_CACHE=/cache/trunk/
EOF

# Setup npm cache
mkdir --parents /cache/npm/

chown --recursive "${REMOTE_USER}:" /cache/npm/

cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
export NPM_CONFIG_CACHE=/cache/npm/
EOF

cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
export NPM_CONFIG_CACHE=/cache/npm/
EOF
45 changes: 45 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#Task
/.task/
/Taskfile.yaml
/Taskfile.yml

# Misc
.DS_Store
.todo

# Dependencies
/node_modules/

# Build
/build/

# Debug
*.log

# Typescript
*.tsbuildinfo

# Next.js
next-env.d.ts

# Tracked, but not needed
/.devcontainer/
/.github/
/.trunk/
/.vscode/
/docs/
/openapi/
/.copier-answers.yaml
/.dockerignore
/.envrc
/.gitattributes
/.gitignore
/CONTRIBUTING.md
/docker-compose.yaml
/Dockerfile
/eslint.config.mjs
/LICENSE
/openapi-ts.config.mts
/README.md
/stylelint.config.mjs
/Taskfile.dist.yaml
8 changes: 8 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

# reload when these files change
watch_file flake.lock ./*.nix

# activate the default development shell in the current shell
# --accept-flake-config will accept the nix configuration from the flake without prompting
eval "$(nix print-dev-env path:./ --accept-flake-config)" || true
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Mark everything as vendored
* linguist-vendored
# Treat docs as documentation
/docs/** -linguist-vendored linguist-documentation
# Unmark files in src, so that they are included in language stats
/src/** -linguist-vendored
16 changes: 16 additions & 0 deletions .github/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
changelog:
exclude:
# Exclude PRs with the following labels from the changelog
labels:
- skip-changelog
# Categories are used make sections in the changelog based on PR labels
categories:
- title: 🚀 Features
labels:
- feature
- title: 🐛 Bug Fixes
labels:
- bug
- title: 🧽 Cleanup
labels:
- cleanup
Loading