Skip to content

Commit 927e5f3

Browse files
Added template files (#35)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent f5d15d7 commit 927e5f3

File tree

119 files changed

+10855
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+10855
-2
lines changed

.copier-answers.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2+
_commit: 6107c05
3+
_src_path: ./
4+
accountname: quickplates
5+
appname: react-example
6+
description: React app example ⚛️
7+
envprefix: REACT_EXAMPLE
8+
imagename: apps/react-example
9+
keyprefix: react-example
10+
pages: app
11+
pagesurl: https://quickplates.github.io/react-example
12+
paths: false
13+
port: 5173
14+
registry: true
15+
releases: true
16+
reponame: react-example
17+
repourl: https://github.com/quickplates/react-example

.devcontainer/devcontainer.json

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
// Build the base image
3+
"build": {
4+
// Docker context to use, relative to this file
5+
"context": "image/",
6+
// Dockerfile to use, relative to this file
7+
"dockerfile": "image/Dockerfile",
8+
// Build options
9+
"options": [
10+
// Use host network
11+
"--network=host"
12+
]
13+
},
14+
// Tool-specific settings
15+
"customizations": {
16+
// VS Code settings
17+
"vscode": {
18+
// Extensions to install
19+
"extensions": [
20+
// Nix
21+
"jnoortheen.nix-ide",
22+
// Direnv
23+
"mkhl.direnv",
24+
// Task
25+
"task.vscode-task",
26+
// Trunk
27+
"Trunk.io"
28+
],
29+
// Settings to override
30+
"settings": {
31+
// Set Trunk as the default formatter
32+
"editor.defaultFormatter": "trunk.io",
33+
// Use LSP for Nix
34+
"nix.enableLanguageServer": true,
35+
// Use nil as the language server
36+
"nix.serverPath": "nil",
37+
"nix.serverSettings": {
38+
"nil": {
39+
"formatting": {
40+
// Use 'nix fmt' for formatting
41+
"command": ["nix", "fmt", "--", "-"]
42+
}
43+
}
44+
},
45+
// Don't forward ports automatically
46+
"remote.autoForwardPorts": false,
47+
// Use Nix IDE instead of Trunk for Nix files
48+
"[nix]": {
49+
"editor.defaultFormatter": "jnoortheen.nix-ide"
50+
}
51+
}
52+
}
53+
},
54+
// Extra features to install to the container
55+
"features": {
56+
// Install Nix
57+
"ghcr.io/devcontainers/features/nix:1.2.0": {
58+
// Enable experimental features
59+
"extraNixConfig": "experimental-features = nix-command flakes",
60+
"version": "2.26.2"
61+
},
62+
// Install Direnv
63+
"ghcr.io/devcontainers-extra/features/direnv:1.0.2": {
64+
"version": "2.35.0"
65+
},
66+
// Enable using Docker from within the container
67+
"ghcr.io/devcontainers/features/docker-in-docker:2.12.0": {
68+
"version": "27.5.1"
69+
},
70+
// Install Starship
71+
"ghcr.io/devcontainers-extra/features/starship:1.0.9": {
72+
"version": "1.22.1"
73+
}
74+
},
75+
// Volumes
76+
"mounts": [
77+
// Mount secrets (shared)
78+
"source=devcontainer-shared-secrets,target=/secrets/,type=volume",
79+
// Mount nix store (not shared)
80+
"source=devcontainer-${devcontainerId}-nix,target=/nix/,type=volume",
81+
// Mount shell history (not shared)
82+
"source=devcontainer-${devcontainerId}-shellhistory-persist,target=/persist/shellhistory/,type=volume",
83+
// Mount trunk cache (shared)
84+
"source=devcontainer-shared-trunk-cache,target=/cache/trunk/,type=volume",
85+
// Mount npm cache (shared)
86+
"source=devcontainer-shared-npm-cache,target=/cache/npm/,type=volume"
87+
],
88+
// Run a command when the container is created
89+
"onCreateCommand": "/hooks/create.sh",
90+
// Environment variables
91+
"remoteEnv": {
92+
// Set workspace path
93+
"WORKSPACE": "${containerWorkspaceFolder}"
94+
},
95+
// Run arguments
96+
"runArgs": [
97+
// Use host UTS namespace
98+
"--uts=host",
99+
// Use host IPC
100+
"--ipc=host",
101+
// Use host network
102+
"--network=host",
103+
// Use host user namespace
104+
"--userns=host",
105+
// Use host cgroup namespace
106+
"--cgroupns=host",
107+
// Run with elevated privileges
108+
"--privileged"
109+
]
110+
}

.devcontainer/image/Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Using one of the offical dev container images as base
2+
# Going with Ubuntu, because it has glibc, which some tools might need
3+
# It also has git, zsh and a bunch of other stuff preinstalled
4+
# Also, it includes a non-root 'vscode' user with sudo access
5+
# The version is pinned to ensure reproducibility
6+
FROM mcr.microsoft.com/devcontainers/base:1.2.3-ubuntu-24.04
7+
8+
ENV REMOTE_USER=vscode
9+
10+
# Setup script
11+
COPY setup.sh /tmp/setup.sh
12+
13+
RUN /tmp/setup.sh && \
14+
rm /tmp/setup.sh
15+
16+
# Lifecycle hooks
17+
COPY hooks/ /hooks/

.devcontainer/image/hooks/create.sh

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
# Create shell history cache files if they don't exist for some reason
4+
touch /persist/shellhistory/.bash_history
5+
touch /persist/shellhistory/.zsh_history
6+
7+
# Use GitHub token secret if it exists
8+
if [[ -s /secrets/.ghtoken && -r /secrets/.ghtoken ]]; then
9+
token="$(cat /secrets/.ghtoken)"
10+
confighome="${XDG_CONFIG_HOME:-${HOME}/.config/}"
11+
12+
# Add GitHub token to Nix config
13+
configfile="${confighome}/nix/nix.conf"
14+
tmpfile="$(mktemp)"
15+
16+
mkdir --parents "$(dirname "${configfile}")"
17+
touch "${configfile}"
18+
19+
if grep --quiet extra-access-tokens "${configfile}"; then
20+
sed "s|extra-access-tokens.*|extra-access-tokens = github.com=${token}|" "${configfile}" >"${tmpfile}"
21+
cat "${tmpfile}" >"${configfile}"
22+
rm "${tmpfile}"
23+
else
24+
echo "extra-access-tokens = github.com=${token}" >>"${configfile}"
25+
fi
26+
fi

.devcontainer/image/setup.sh

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env bash
2+
3+
REMOTE_USER="${REMOTE_USER:?}"
4+
REMOTE_USER_PASSWD="$(getent passwd "${REMOTE_USER}")"
5+
REMOTE_USER_HOME="$(echo "${REMOTE_USER_PASSWD}" | cut --delimiter ':' --fields 6)"
6+
7+
# Setup default shell
8+
chsh --shell /usr/bin/zsh "${REMOTE_USER}"
9+
10+
# Setup direnv
11+
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
12+
eval "\$(direnv hook bash)"
13+
EOF
14+
15+
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
16+
eval "\$(direnv hook zsh)"
17+
EOF
18+
19+
# Setup starship
20+
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
21+
eval "\$(starship init bash)"
22+
EOF
23+
24+
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
25+
eval "\$(starship init zsh)"
26+
EOF
27+
28+
# Setup secrets directory
29+
mkdir --parents /secrets/
30+
31+
chown --recursive "${REMOTE_USER}:" /secrets/
32+
33+
# Setup shell history cache
34+
mkdir --parents /persist/shellhistory/
35+
36+
touch /persist/shellhistory/.bash_history
37+
touch /persist/shellhistory/.zsh_history
38+
39+
chown --recursive "${REMOTE_USER}:" /persist/shellhistory/
40+
41+
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
42+
export HISTFILE=/persist/shellhistory/.bash_history
43+
EOF
44+
45+
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
46+
export HISTFILE=/persist/shellhistory/.zsh_history
47+
EOF
48+
49+
# Setup trunk cache
50+
mkdir --parents /cache/trunk/
51+
52+
chown --recursive "${REMOTE_USER}:" /cache/trunk/
53+
54+
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
55+
export TRUNK_CACHE=/cache/trunk/
56+
EOF
57+
58+
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
59+
export TRUNK_CACHE=/cache/trunk/
60+
EOF
61+
62+
# Setup npm cache
63+
mkdir --parents /cache/npm/
64+
65+
chown --recursive "${REMOTE_USER}:" /cache/npm/
66+
67+
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
68+
export NPM_CONFIG_CACHE=/cache/npm/
69+
EOF
70+
71+
cat <<EOF >>"${REMOTE_USER_HOME}/.zshrc"
72+
export NPM_CONFIG_CACHE=/cache/npm/
73+
EOF

.dockerignore

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#Task
2+
/.task/
3+
/Taskfile.yaml
4+
/Taskfile.yml
5+
6+
# Misc
7+
.DS_Store
8+
.todo
9+
10+
# Dependencies
11+
/node_modules/
12+
13+
# Build
14+
/build/
15+
16+
# Debug
17+
npm-debug.log*
18+
19+
# Typescript
20+
*.tsbuildinfo
21+
22+
# Tracked, but not needed
23+
/.devcontainer/
24+
/.github/
25+
/.trunk/
26+
/.vscode/
27+
/.copier-answers.yaml
28+
/.dockerignore
29+
/.envrc
30+
/.gitattributes
31+
/.gitignore
32+
/CONTRIBUTING.md
33+
/docker-compose.yaml
34+
/Dockerfile
35+
/LICENSE
36+
/README.md
37+
/Taskfile.dist.yaml

.envrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
# reload when these files change
4+
watch_file flake.lock ./*.nix
5+
6+
# activate the default development shell in the current shell
7+
# --accept-flake-config will accept the nix configuration from the flake without prompting
8+
eval "$(nix print-dev-env path:./ --accept-flake-config)" || true

.gitattributes

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Mark everything as vendored
2+
* linguist-vendored
3+
# Unmark files in src, so that they are included in language stats
4+
/src/** -linguist-vendored

.github/release.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
changelog:
2+
exclude:
3+
# Exclude PRs with the following labels from the changelog
4+
labels:
5+
- skip-changelog
6+
# Categories are used make sections in the changelog based on PR labels
7+
categories:
8+
- title: 🚀 Features
9+
labels:
10+
- feature
11+
- title: 🐛 Bug Fixes
12+
labels:
13+
- bug
14+
- title: 🧽 Cleanup
15+
labels:
16+
- cleanup

0 commit comments

Comments
 (0)