-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: new installation method * feat: add new commands list * feat: add demo account * feat: add usb installer picture * feat: update root user packages * feat: update demovm secrets * feat: use home-manager NixOS module
- Loading branch information
Showing
229 changed files
with
4,355 additions
and
4,818 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
use flake | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: pre-commit | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v3 | ||
- uses: pre-commit/action@v3.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
repos: | ||
- repo: 'https://github.com/pre-commit/pre-commit-hooks' | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-executables-have-shebangs | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-yaml | ||
- id: detect-aws-credentials | ||
args: [--allow-missing-credentials] | ||
- id: detect-private-key | ||
- id: end-of-file-fixer | ||
- id: no-commit-to-branch | ||
args: ['--branch', 'main'] | ||
- id: trailing-whitespace | ||
- repo: local | ||
hooks: | ||
- id: nixpkgs-fmt | ||
name: nixpkgs-fmt | ||
description: Format nix code with nixpkgs-fmt. | ||
language: system | ||
entry: nixpkgs-fmt | ||
files: \.nix$ | ||
stages: | ||
- commit | ||
- id: docupdate | ||
name: docupdate | ||
description: Update documentation. | ||
language: system | ||
entry: just doc-update | ||
stages: | ||
- commit | ||
files: ^README\.md$ | ||
- id: check-secrets | ||
name: check-test-age-public-key | ||
description: Check test age public key | ||
language: python | ||
entry: ./.pre-commit-scripts/check-public-test-age-key.py | ||
stages: | ||
- commit | ||
files: secrets\.yml$ | ||
- id: deno-fmt | ||
name: deno-fmt | ||
description: Format deno code with deno fmt. | ||
language: system | ||
entry: deno fmt | ||
stages: | ||
- commit | ||
files: \.ts$ | ||
- id: deno-lint | ||
name: deno-lint | ||
description: Lint deno code with deno lint. | ||
language: system | ||
entry: deno lint | ||
stages: | ||
- commit | ||
files: \.ts$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from __future__ import annotations | ||
|
||
import sys | ||
import re | ||
|
||
# Check if the age key only used on hosts/vm-test folder | ||
|
||
import argparse | ||
from typing import Sequence | ||
|
||
# read text file and convert to array | ||
with open(".sops.yaml") as f: | ||
SOPSLINES = f.readlines() | ||
|
||
SOPSLINES = [line for line in SOPSLINES if "&demo" in line or "&demovm" in line] | ||
|
||
# Extract age key from SOPSLINES Array | ||
AGEKEYS = re.findall(r"age[a-z0-9]+", "".join(SOPSLINES)) | ||
|
||
# Convert to bytes | ||
AGEKEYS = [str.encode(line) for line in AGEKEYS] | ||
|
||
IGNORE = ["hosts/demovm/secrets.yml" "users/demo/secrets.yml"] | ||
|
||
|
||
def main(argv: Sequence[str] | None = None) -> int: | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("filenames", nargs="*", help="Filenames to check") | ||
args = parser.parse_args(argv) | ||
|
||
age_key_files = [] | ||
|
||
# Check if the age key is found in the file | ||
for filename in args.filenames: | ||
with open(filename, "rb") as f: | ||
content = f.read() | ||
if any(agekey in content for agekey in AGEKEYS) and filename in IGNORE: | ||
age_key_files.append(filename) | ||
|
||
if age_key_files: | ||
for age_key_file in age_key_files: | ||
print(f"Age key found in a file other than the demo file: {age_key_file}") | ||
return 1 | ||
else: | ||
return 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
raise SystemExit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env -S deno run --allow-sys --allow-read --allow-env --allow-net --allow-run --allow-write | ||
|
||
function replaceCode(tag: string, content: string, replace: string): string { | ||
const regex = new RegExp(`<!-- ${tag} -->.*/${tag} -->`, "sm"); | ||
return content.replace( | ||
regex, | ||
`<!-- ${tag} -->\n\n\`\`\`text\n${replace}\`\`\`\n\n<!-- /${tag} -->`, | ||
); | ||
} | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// Read README.md | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
const doc = await Deno.readTextFile("README.md"); | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// Execute commands | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
// List commands | ||
const cmdcommands = new Deno.Command("just", {}); | ||
let { stdout } = await cmdcommands.output(); | ||
const outputcommands = new TextDecoder().decode(stdout); | ||
|
||
// List packages | ||
const cmdpackages = new Deno.Command("just", { args: ["packages"] }); | ||
({ stdout } = await cmdpackages.output()); | ||
const outputpackages = new TextDecoder().decode(stdout); | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// Replace tags | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
let result = replaceCode("COMMANDS", doc, outputcommands); | ||
result = replaceCode("PACKAGES", result, outputpackages); | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// Update READLE.md | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
await Deno.writeTextFile("README.md", result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.