Skip to content

Commit

Permalink
Fetched template changes
Browse files Browse the repository at this point in the history
  • Loading branch information
spietras committed Mar 26, 2024
1 parent c12aea6 commit 8f9e220
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: 0.6.0
_commit: 0.7.0
_src_path: gh:quickplates/meta
accountname: quickplates
description: Protocol Buffers API template 📜
Expand Down
7 changes: 6 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
// Docker context to use, relative to this file
"context": "image/",
// Dockerfile to use, relative to this file
"dockerfile": "image/Dockerfile"
"dockerfile": "image/Dockerfile",
// Build options
"options": [
// Use host network
"--network=host"
]
},
// Tool-specific settings
"customizations": {
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/image/hooks/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ if [[ -s /secrets/.ghtoken && -r /secrets/.ghtoken ]]; then
configfile="${confighome}/nix/nix.conf"
tmpfile="$(mktemp)"

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

if grep -q extra-access-tokens "${configfile}"; then
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}"
Expand Down
16 changes: 8 additions & 8 deletions .devcontainer/image/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

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

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

# Setup direnv
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
Expand All @@ -26,17 +26,17 @@ eval "\$(starship init zsh)"
EOF

# Setup secrets directory
mkdir -p /secrets/
mkdir --parents /secrets/

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

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

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

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

cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
export HISTFILE=/persist/shellhistory/.bash_history
Expand All @@ -47,9 +47,9 @@ export HISTFILE=/persist/shellhistory/.zsh_history
EOF

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

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

cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
export TRUNK_CACHE=/cache/trunk/
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
if: "!cancelled()"
run: >
mkdir
-p
--parents
${{ env.NIX_CACHE_DIR }}
&&
nix-store
Expand All @@ -117,7 +117,7 @@ jobs:
- name: Extract archive
run: >
mkdir
-p
--parents
build/
&&
tar
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
- name: Copy build output
run: >
cp
-r
--recursive
build/.
example/
- name: Add changes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
if: "!cancelled()"
run: >
mkdir
-p
--parents
${{ env.NIX_CACHE_DIR }}
&&
nix-store
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
if: "!cancelled()"
run: >
mkdir
-p
--parents
${{ env.NIX_CACHE_DIR }}
&&
nix-store
Expand Down
4 changes: 2 additions & 2 deletions src/{% if docs %}docs{% endif %}/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"predocs": "npm run generate",
"docs": "docusaurus",
"update": "ncu --peer --doctor --upgrade && npm i --no-audit --no-fund",
"postupdate": "rm -rf .tmp/",
"postupdate": "rm --recursive --force .tmp/",
"pretest": "npm run generate",
"test": "docusaurus build --out-dir .tmp/",
"posttest": "rm -rf .tmp/"
"posttest": "rm --recursive --force .tmp/"
},
"engines": {
"node": ">=18.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
// Docker context to use, relative to this file
"context": "image/",
// Dockerfile to use, relative to this file
"dockerfile": "image/Dockerfile"
"dockerfile": "image/Dockerfile",
// Build options
"options": [
// Use host network
"--network=host"
]
},
// Tool-specific settings
"customizations": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ if [[ -s /secrets/.ghtoken && -r /secrets/.ghtoken ]]; then
configfile="${confighome}/nix/nix.conf"
tmpfile="$(mktemp)"

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

if grep -q extra-access-tokens "${configfile}"; then
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}"
Expand Down
20 changes: 10 additions & 10 deletions src/{% if true %}.devcontainer{% endif %}/image/setup.sh.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

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

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

# Setup direnv
cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
Expand All @@ -26,17 +26,17 @@ eval "\$(starship init zsh)"
EOF

# Setup secrets directory
mkdir -p /secrets/
mkdir --parents /secrets/

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

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

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

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

cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
export HISTFILE=/persist/shellhistory/.bash_history
Expand All @@ -47,9 +47,9 @@ export HISTFILE=/persist/shellhistory/.zsh_history
EOF

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

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

cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
export TRUNK_CACHE=/cache/trunk/
Expand All @@ -61,9 +61,9 @@ EOF
{%- if docs %}

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

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

cat <<EOF >>"${REMOTE_USER_HOME}/.bashrc"
export NPM_CONFIG_CACHE=/cache/npm/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
if: "!cancelled()"
run: >
mkdir
-p
--parents
{{ '${{ env.NIX_CACHE_DIR }}' }}
&&
nix-store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
if: "!cancelled()"
run: >
mkdir
-p
--parents
${{ env.NIX_CACHE_DIR }}
&&
nix-store
Expand Down

0 comments on commit 8f9e220

Please sign in to comment.