Skip to content

Commit 5e269df

Browse files
authored
Added initial version (#1)
1 parent 98c2d86 commit 5e269df

File tree

101 files changed

+21420
-1
lines changed

Some content is hidden

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

101 files changed

+21420
-1
lines changed

.copier-answers.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2+
_commit: 0.7.1
3+
_src_path: gh:quickplates/meta
4+
accountname: quickplates
5+
description: NixOS configs template ❄️
6+
example: true
7+
exampleaccountname: quickplates
8+
exampledescription: NixOS configs example ❄️
9+
examplereponame: nixos-example
10+
reponame: nixos
11+
repourl: https://github.com/quickplates/nixos
12+
type: generic

.devcontainer/devcontainer.json

+296
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,296 @@
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+
// Python
25+
"ms-python.python",
26+
// Jinja
27+
"samuelcolvin.jinjahtml",
28+
// TOML
29+
"tamasfe.even-better-toml",
30+
// Task
31+
"task.vscode-task",
32+
// Trunk
33+
"Trunk.io"
34+
],
35+
// Settings to override
36+
"settings": {
37+
// Set Trunk as the default formatter
38+
"editor.defaultFormatter": "trunk.io",
39+
// Associate templated files
40+
"files.associations": {
41+
"*.html.jinja": "jinja-html",
42+
"*.html*endif*.jinja": "jinja-html",
43+
"*.xml*endif*.jinja": "jinja-xml",
44+
"*.css*endif*.jinja": "jinja-css",
45+
"*.json*endif*.jinja": "jinja-json",
46+
"*.md*endif*.jinja": "jinja-md",
47+
"*.yml*endif*.jinja": "jinja-yaml",
48+
"*.yaml*endif*.jinja": "jinja-yaml",
49+
"*_copier_conf.answers_file*.jinja": "jinja-yaml",
50+
"*.toml*endif*.jinja": "jinja-toml",
51+
"*.tex*endif*.jinja": "jinja-latex",
52+
"*.latex*endif*.jinja": "jinja-latex",
53+
"*.lua*endif*.jinja": "jinja-lua",
54+
"*.properties.jinja": "jinja-properties",
55+
"*.properties*endif*.jinja": "jinja-properties",
56+
"*.cfg.jinja": "jinja-properties",
57+
"*.cfg*endif*.jinja": "jinja-properties",
58+
"*.conf.jinja": "jinja-properties",
59+
"*.conf*endif*.jinja": "jinja-properties",
60+
"*.desktop.jinja": "jinja-properties",
61+
"*.desktop*endif*.jinja": "jinja-properties",
62+
"*.directory.jinja": "jinja-properties",
63+
"*.directory*endif*.jinja": "jinja-properties",
64+
"*.ini.jinja": "jinja-properties",
65+
"*.ini*endif*.jinja": "jinja-properties",
66+
"*.sh.jinja": "jinja-shell",
67+
"*.sh*endif*.jinja": "jinja-shell",
68+
"*.bash.jinja": "jinja-shell",
69+
"*.bash*endif*.jinja": "jinja-shell",
70+
"*.bashrc.jinja": "jinja-shell",
71+
"*.bashrc*endif*.jinja": "jinja-shell",
72+
"*.bash_aliases.jinja": "jinja-shell",
73+
"*.bash_aliases*endif*.jinja": "jinja-shell",
74+
"*.bash_profile.jinja": "jinja-shell",
75+
"*.bash_profile*endif*.jinja": "jinja-shell",
76+
"*.bash_login.jinja": "jinja-shell",
77+
"*.bash_login*endif*.jinja": "jinja-shell",
78+
"*.ebuild.jinja": "jinja-shell",
79+
"*.ebuild*endif*.jinja": "jinja-shell",
80+
"*.install.jinja": "jinja-shell",
81+
"*.install*endif*.jinja": "jinja-shell",
82+
"*.profile.jinja": "jinja-shell",
83+
"*.profile*endif*.jinja": "jinja-shell",
84+
"*.bash_logout.jinja": "jinja-shell",
85+
"*.bash_logout*endif*.jinja": "jinja-shell",
86+
"*.zsh.jinja": "jinja-shell",
87+
"*.zsh*endif*.jinja": "jinja-shell",
88+
"*.zshrc.jinja": "jinja-shell",
89+
"*.zshrc*endif*.jinja": "jinja-shell",
90+
"*.zprofile.jinja": "jinja-shell",
91+
"*.zprofile*endif*.jinja": "jinja-shell",
92+
"*.zlogin.jinja": "jinja-shell",
93+
"*.zlogin*endif*.jinja": "jinja-shell",
94+
"*.zlogout.jinja": "jinja-shell",
95+
"*.zlogout*endif*.jinja": "jinja-shell",
96+
"*.zshenv.jinja": "jinja-shell",
97+
"*.zshenv*endif*.jinja": "jinja-shell",
98+
"*.zsh-theme.jinja": "jinja-shell",
99+
"*.zsh-theme*endif*.jinja": "jinja-shell",
100+
"*.ksh.jinja": "jinja-shell",
101+
"*.ksh*endif*.jinja": "jinja-shell",
102+
"*.envrc.jinja": "jinja-shell",
103+
"*.envrc*endif*.jinja": "jinja-shell",
104+
"*.Dockerfile.jinja": "jinja-dockerfile",
105+
"*.Dockerfile*endif*.jinja": "jinja-dockerfile",
106+
"*.sql*endif*.jinja": "jinja-sql",
107+
"*.py*endif*.jinja": "jinja-py",
108+
"*.pyi*endif*.jinja": "jinja-py",
109+
"*.pyx*endif*.jinja": "jinja-cy",
110+
"*.pxd*endif*.jinja": "jinja-cy",
111+
"*.pxi*endif*.jinja": "jinja-cy",
112+
"*.tf*endif*.jinja": "jinja-terraform",
113+
"*.tfvars*endif*.jinja": "jinja-terraform",
114+
"*.hcl*endif*.jinja": "jinja-terraform",
115+
"*.groovy*endif*.jinja": "jinja-groovy",
116+
"*.link*endif*.jinja": "jinja-systemd",
117+
"*.netdev*endif*.jinja": "jinja-systemd",
118+
"*.network*endif*.jinja": "jinja-systemd",
119+
"*.service*endif*.jinja": "jinja-systemd",
120+
"*.socket*endif*.jinja": "jinja-systemd",
121+
"*.device*endif*.jinja": "jinja-systemd",
122+
"*.mount*endif*.jinja": "jinja-systemd",
123+
"*.automount*endif*.jinja": "jinja-systemd",
124+
"*.swap*endif*.jinja": "jinja-systemd",
125+
"*.target*endif*.jinja": "jinja-systemd",
126+
"*.path*endif*.jinja": "jinja-systemd",
127+
"*.timer*endif*.jinja": "jinja-systemd",
128+
"*.snapshot*endif*.jinja": "jinja-systemd",
129+
"*.slice*endif*.jinja": "jinja-systemd",
130+
"*.scope*endif*.jinja": "jinja-systemd",
131+
"*.c*endif*.jinja": "jinja-cpp",
132+
"*.cpp*endif*.jinja": "jinja-cpp",
133+
"*.h*endif*.jinja": "jinja-cpp",
134+
"*.java*endif*.jinja": "jinja-java",
135+
"*.php*endif*.jinja": "jinja-php",
136+
"*.ios*endif*.jinja": "jinja-cisco",
137+
"*.cisco*endif*.jinja": "jinja-cisco",
138+
"*.rs*endif*.jinja": "jinja-rust",
139+
"*.abap?? endif ??": "abap",
140+
"*.bat?? endif ??": "bat",
141+
"*.bib?? endif ??": "bibtex",
142+
"*.clj?? endif ??": "clojure",
143+
"*.coffee?? endif ??": "coffeescript",
144+
"*.c?? endif ??": "c",
145+
"*.cpp?? endif ??": "cpp",
146+
"*.cs?? endif ??": "csharp",
147+
"*.docker-compose.yml?? endif ??": "dockercompose",
148+
"*.docker-compose.override.yml?? endif ??": "dockercompose",
149+
"*.css?? endif ??": "css",
150+
"*.cu?? endif ??": "cuda-cpp",
151+
"*.cuh?? endif ??": "cuda-cpp",
152+
"*.diff?? endif ??": "diff",
153+
"*.patch?? endif ??": "diff",
154+
"*.Dockerfile?? endif ??": "dockerfile",
155+
"*.fs?? endif ??": "fsharp",
156+
"*.fsx?? endif ??": "fsharp",
157+
"*.fsi?? endif ??": "fsharp",
158+
"*.COMMIT_EDITMSG?? endif ??": "git-commit",
159+
"*.git-rebase-todo?? endif ??": "git-rebase",
160+
"*.go?? endif ??": "go",
161+
"*.groovy?? endif ??": "groovy",
162+
"*.gradle?? endif ??": "groovy",
163+
"*.hbs?? endif ??": "handlebars",
164+
"*.handlebars?? endif ??": "handlebars",
165+
"*.haml?? endif ??": "haml",
166+
"*.html?? endif ??": "html",
167+
"*.htm?? endif ??": "html",
168+
"*.xhtml?? endif ??": "html",
169+
"*.ini?? endif ??": "ini",
170+
"*.java?? endif ??": "java",
171+
"*.js?? endif ??": "javascript",
172+
"*.jsx?? endif ??": "javascriptreact",
173+
"*.json?? endif ??": "json",
174+
"*.jsonc?? endif ??": "jsonc",
175+
"*.tex?? endif ??": "latex",
176+
"*.less?? endif ??": "less",
177+
"*.lua?? endif ??": "lua",
178+
"*.makefile?? endif ??": "makefile",
179+
"*.mk?? endif ??": "makefile",
180+
"*.mak?? endif ??": "makefile",
181+
"*.md?? endif ??": "markdown",
182+
"*.m?? endif ??": "objective-c",
183+
"*.mm?? endif ??": "objective-cpp",
184+
"*.pl?? endif ??": "perl",
185+
"*.pm?? endif ??": "perl",
186+
"*.php?? endif ??": "php",
187+
"*.php3?? endif ??": "php",
188+
"*.php4?? endif ??": "php",
189+
"*.php5?? endif ??": "php",
190+
"*.phtml?? endif ??": "php",
191+
"*.txt?? endif ??": "plaintext",
192+
"*.text?? endif ??": "plaintext",
193+
"*.conf?? endif ??": "plaintext",
194+
"*.def?? endif ??": "plaintext",
195+
"*.list?? endif ??": "plaintext",
196+
"*.log?? endif ??": "plaintext",
197+
"*.in?? endif ??": "plaintext",
198+
"*.ps1?? endif ??": "powershell",
199+
"*.psm1?? endif ??": "powershell",
200+
"*.psd1?? endif ??": "powershell",
201+
"*.jade?? endif ??": "pug",
202+
"*.pug?? endif ??": "pug",
203+
"*.py?? endif ??": "python",
204+
"*.pyw?? endif ??": "python",
205+
"*.r?? endif ??": "r",
206+
"*.cshtml?? endif ??": "razor",
207+
"*.rb?? endif ??": "ruby",
208+
"*.rs?? endif ??": "rust",
209+
"*.scss?? endif ??": "scss",
210+
"*.sass?? endif ??": "sass",
211+
"*.shader?? endif ??": "shaderlab",
212+
"*.sh?? endif ??": "shellscript",
213+
"*.slim?? endif ??": "slim",
214+
"*.sql?? endif ??": "sql",
215+
"*.styl?? endif ??": "stylus",
216+
"*.stylus?? endif ??": "stylus",
217+
"*.swift?? endif ??": "swift",
218+
"*.ts?? endif ??": "typescript",
219+
"*.tsx?? endif ??": "typescriptreact",
220+
"*.xml?? endif ??": "xml",
221+
"*.xsl?? endif ??": "xsl",
222+
"*.yaml?? endif ??": "yaml",
223+
"*.yml?? endif ??": "yaml"
224+
},
225+
// Use LSP for Nix
226+
"nix.enableLanguageServer": true,
227+
// Use nil as the language server
228+
"nix.serverPath": "nil",
229+
"nix.serverSettings": {
230+
"nil": {
231+
"formatting": {
232+
// Use 'nix fmt' for formatting
233+
"command": ["nix", "fmt", "--", "-"]
234+
}
235+
}
236+
},
237+
// Don't forward ports automatically
238+
"remote.autoForwardPorts": false,
239+
// Use Nix IDE instead of Trunk for Nix files
240+
"[nix]": {
241+
"editor.defaultFormatter": "jnoortheen.nix-ide"
242+
}
243+
}
244+
}
245+
},
246+
// Extra features to install to the container
247+
"features": {
248+
// Install Nix
249+
"ghcr.io/devcontainers/features/nix:1.2.0": {
250+
// Enable experimental features
251+
"extraNixConfig": "experimental-features = nix-command flakes",
252+
"version": "2.20.5"
253+
},
254+
// Install Direnv
255+
"ghcr.io/devcontainers-contrib/features/direnv:1.0.2": {
256+
"version": "2.34.0"
257+
},
258+
// Install Starship
259+
"ghcr.io/devcontainers-contrib/features/starship:1.0.9": {
260+
"version": "1.17.1"
261+
}
262+
},
263+
// Volumes
264+
"mounts": [
265+
// Mount secrets (shared)
266+
"source=devcontainer-shared-secrets,target=/secrets/,type=volume",
267+
// Mount nix store (not shared)
268+
"source=devcontainer-${devcontainerId}-nix,target=/nix/,type=volume",
269+
// Mount shell history (not shared)
270+
"source=devcontainer-${devcontainerId}-shellhistory-persist,target=/persist/shellhistory/,type=volume",
271+
// Mount trunk cache (shared)
272+
"source=devcontainer-shared-trunk-cache,target=/cache/trunk/,type=volume"
273+
],
274+
// Run a command when the container is created
275+
"onCreateCommand": "/hooks/create.sh",
276+
// Environment variables
277+
"remoteEnv": {
278+
// Set workspace path
279+
"WORKSPACE": "${containerWorkspaceFolder}"
280+
},
281+
// Run arguments
282+
"runArgs": [
283+
// Use host UTS namespace
284+
"--uts=host",
285+
// Use host IPC
286+
"--ipc=host",
287+
// Use host network
288+
"--network=host",
289+
// Use host user namespace
290+
"--userns=host",
291+
// Use host cgroup namespace
292+
"--cgroupns=host",
293+
// Run with elevated privileges
294+
"--privileged"
295+
]
296+
}

.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.0.22-ubuntu-22.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

0 commit comments

Comments
 (0)