dotfiles

My PC Dotfiles & Website
commit 74391c5e8dd5d2342a973a27c2fa74adcd2ef25c
parent 1591886a5d6fb483878325a7c2f417eb07589ebd
Author: maydayv7 <maydayv7@gmail.com>
Date:   Fri,  2 Jan 2026 02:37:39 +0530

feat(site): `stagit` Site

Diffstat:

A.github/workflows/website-git.yaml | 47+++++++++++++++++++++++++++++++++++++++++++++++
A.gitignore | 4++++
MCHANGELOG.md | 2+-
Mflake.lock | 24++++++++++++++++++++++++
Mflake.nix | 27++++++++++++++++++---------
Mpackages/flake.nix | 1+
Dsite/.gitignore | 2--
Msite/content/blog/nixos/prelude.md | 2++
Msite/default.nix | 5++---
Msite/flake.nix | 7+++++--
Asite/git/base.css | 292+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asite/git/default.nix | 105+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asite/git/index.js | 35+++++++++++++++++++++++++++++++++++
Asite/git/repos.nix | 9+++++++++
Asite/git/theme.nix | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asite/git/wrangler.toml | 14++++++++++++++
Msite/shell.nix | 2+-
17 files changed, 648 insertions(+), 18 deletions(-)

diff --git a/.github/workflows/website-git.yaml b/.github/workflows/website-git.yaml @@ -0,0 +1,47 @@ +name: "ci: Build and Deploy Git Site" +on: + workflow_dispatch: + push: + branches: + - stable + paths: + - "site/git/**" + pull_request: + paths: + - "site/git/**" +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Clone Repo + uses: actions/checkout@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 + - name: Install Nix + uses: cachix/install-nix-action@v31 + with: + extra_nix_config: | + experimental-features = nix-command flakes + accept-flake-config = true + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + - name: Build Stagit Site + run: nix run .#build-stagit + - name: Prepare for Deployment + run: | + rm -rf site/git/public + mkdir -p site/git/public + cp -rL public/* site/git/public/ + - name: Deploy to Cloudflare + id: deploy + uses: cloudflare/wrangler-action@v3 + with: + workingDirectory: "site/git" + wranglerVersion: "latest" + command: deploy ${{ github.ref == 'refs/heads/stable' && '--env production' || '' }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + gitHubToken: ${{ secrets.GITHUB_TOKEN }} + - name: Print Deployment URL + run: | + echo "Site deployed to: ${{ steps.deploy.outputs.deployment-url }}" diff --git a/.gitignore b/.gitignore @@ -0,0 +1,4 @@ +~* +result +public +site/static/processed_images diff --git a/CHANGELOG.md b/CHANGELOG.md @@ -5,7 +5,7 @@ - Website Changes - Start blogging! - Fix comments - - Host Gitea + - Host `stagit` generated site ## 2025 diff --git a/flake.lock b/flake.lock @@ -648,6 +648,7 @@ "sops": "sops", "spicetify": "spicetify", "stable": "stable", + "stagit": "stagit", "stylix": "stylix", "systems": "systems_2", "unstable": "unstable", @@ -736,6 +737,29 @@ "type": "github" } }, + "stagit": { + "inputs": { + "nixpkgs": [ + "stable" + ], + "utils": [ + "utils" + ] + }, + "locked": { + "lastModified": 1767300315, + "narHash": "sha256-KZHyOaFrwh/IBn8wTc3tImVHwpeRi/RJtaD9kt1iNNg=", + "owner": "maydayv7", + "repo": "stagit", + "rev": "6aa8a5443cec322bf8e7a09a1ff03c34f71d96af", + "type": "github" + }, + "original": { + "owner": "maydayv7", + "repo": "stagit", + "type": "github" + } + }, "stylix": { "inputs": { "base16": "base16", diff --git a/flake.nix b/flake.nix @@ -53,6 +53,21 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + # Peronal Stagit Fork + stagit = { + url = "github:maydayv7/stagit"; + inputs = { + nixpkgs.follows = "stable"; + utils.follows = "utils"; + }; + }; + + # VS Code Extensions + vscode = { + url = "github:nix-community/nix-vscode-extensions"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + ## Configuration Modules ## ## Language Addendum # Supported Architectures @@ -83,15 +98,15 @@ }; ## Feature Modules + # Hardware Support + hardware.url = "github:NixOS/nixos-hardware"; + # User Home Manager home = { url = "github:nix-community/home-manager?ref=release-25.11"; inputs.nixpkgs.follows = "nixpkgs"; }; - # Hardware Support - hardware.url = "github:NixOS/nixos-hardware"; - # Secure Boot boot = { url = "github:nix-community/lanzaboote/v0.4.3"; @@ -119,12 +134,6 @@ # Declarative Flatpak Wrapper flatpak.url = "github:gmodena/nix-flatpak?ref=latest"; - # VS Code Extensions - vscode = { - url = "github:nix-community/nix-vscode-extensions"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - # Discord Module nixcord = { url = "github:FlameFlag/nixcord"; diff --git a/packages/flake.nix b/packages/flake.nix @@ -35,6 +35,7 @@ in overlays = (attrValues self.overlays or { }) ++ [ (_: _: { custom = self.packages."${system}"; + stagit-fork = stagit.packages."${system}".default; unstable = import unstable { inherit system config; }; gaming = gaming.packages."${system}"; diff --git a/site/.gitignore b/site/.gitignore @@ -1,2 +0,0 @@ -public -static/processed_images diff --git a/site/content/blog/nixos/prelude.md b/site/content/blog/nixos/prelude.md @@ -164,5 +164,7 @@ _Thanks a lot! ;)_ --- [^1]: [Meaning](http://gateway-drug.urbanup.com/2175521) ig + [^2]: [Arch Wiki](https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF) + [^3]: T&C Apply ;) diff --git a/site/default.nix b/site/default.nix @@ -2,12 +2,11 @@ site ? null, pkgs, }: -with pkgs; -stdenvNoCC.mkDerivation { +pkgs.stdenvNoCC.mkDerivation { pname = "website"; version = "stable"; src = ./.; - buildInputs = [ zola ]; + buildInputs = [ pkgs.zola ]; installPhase = "cp -r public $out"; buildPhase = "zola build ${if (site != null) then "--base-url " + site else ""}"; } diff --git a/site/flake.nix b/site/flake.nix @@ -1,10 +1,13 @@ _: { ## Website Configuration ## perSystem = - { pkgs, ... }: + { lib, pkgs, ... }: { - # Package packages.website = pkgs.callPackage ./. { inherit pkgs; }; + apps.build-stagit = { + type = "app"; + program = "${pkgs.callPackage ./git { inherit lib pkgs; }}/bin/build-stagit"; + }; # Development Shell devShells.website = import ./shell.nix { inherit pkgs; }; diff --git a/site/git/base.css b/site/git/base.css @@ -0,0 +1,292 @@ +/* Fonts */ +@font-face { + font-family: "JetBrainsMono Nerd Font"; + src: url("/fonts/JetBrainsMono-Nerd-Regular.woff2") format("woff2"); + font-weight: normal; + font-style: normal; +} +@font-face { + font-family: "JetBrainsMono Nerd Font"; + src: url("/fonts/JetBrainsMono-Nerd-Bold.woff2") format("woff2"); + font-weight: bold; + font-style: normal; +} +@font-face { + font-family: "JetBrainsMono Nerd Font"; + src: url("/fonts/JetBrainsMono-Nerd-Italic.woff2") format("woff2"); + font-weight: normal; + font-style: italic; +} + +:root { + --font-main: "JetBrainsMono Nerd Font", monospace; +} + +body { + font-family: var(--font-main); + color: var(--fg); + background-color: var(--bg); + padding: 1rem; + margin: 0; + line-height: 1.5; +} + +a { + text-decoration: none; + color: var(--fg); + &:hover { + text-decoration: underline; + } +} + +/* Header */ +#header { + margin-bottom: 1.5rem; + text-align: left; +} + +tbody td:first-child { + width: 1px; + white-space: nowrap; + padding-right: 10px; +} + +img { + height: 32px; + width: auto; + border-radius: 3px; + vertical-align: middle; +} + +h1 { + margin: 0; +} + +/* Tables */ +table { + width: 100%; + border-collapse: collapse; +} + +td, +th { + padding: 0.25em 0.5em; + text-align: left; + border: 1px solid var(--bg); + white-space: nowrap; +} + +td:empty { + border: none; + background: transparent !important; +} + +#content tr:hover td { + background-color: var(--bg-hover); +} + +th { + font-weight: bold; + border-bottom: 1px solid var(--border); +} + +/* Code Blocks */ +pre { + font-family: var(--font-main); + padding: 0.8em; + overflow: auto; + background-color: var(--bg-code); + border: 1px solid var(--border-subtle); + border-radius: 2px; +} + +/* Diff (File View) */ +.i { + color: var(--diff-add); +} +.d { + color: var(--diff-del); +} +.h { + color: var(--diff-mod); +} + +pre span.i, +pre span.d, +pre span.h { + font-weight: bold; +} + +/* Status (Log View) */ +.A { + color: var(--diff-add); + font-weight: bold; +} +.D { + color: var(--diff-del); + font-weight: bold; +} +.M { + color: var(--diff-mod); + font-weight: bold; +} +.R { + font-weight: bold; +} + +/* Blob View */ +#blob a { + color: var(--fg-dim); + &:hover { + color: var(--fg); + text-decoration: none; + } +} + +/* Metadata */ +.desc { + color: var(--fg-dim); + display: block; + margin-top: 0.2rem; +} + +/* Syntax Highlighting */ + +/* Container Table */ +table#blob.chroma { + width: 100%; + border-collapse: collapse; + font-family: var(--font-main); + background-color: var(--bg-code); + border: 1px solid var(--border-subtle); + border-radius: 2px; + margin-top: 0; + display: table; + table-layout: fixed; +} + +/* Cells */ +#blob.chroma td { + padding: 0 0.5em; + vertical-align: top; + line-height: 1.5; + border: none; +} + +/* Line Numbers */ +#blob.chroma td.num { + width: 1%; + min-width: 2.5em; + text-align: right; + border-right: 1px solid var(--border-subtle); + background-color: var(--code-bg-line-num); + color: var(--fg-dim); + user-select: none; + white-space: nowrap; +} + +/* Code Content Column */ +#blob.chroma td.code { + width: 100%; + white-space: pre-wrap; + word-break: break-all; + padding-left: 1em; +} + +#blob.chroma td.num a { + text-decoration: none; + color: inherit; + &:hover { + color: var(--fg); + } +} + +/* Syntax Colors */ + +/* Comments */ +.chroma .c, +.chroma .c1, +.chroma .cs, +.chroma .cm { + color: var(--fg-dim); + font-style: italic; +} + +/* Keywords */ +.chroma .k, +.chroma .kd, +.chroma .kn, +.chroma .kp, +.chroma .kr { + color: var(--accent-alpha-70); + font-weight: bold; +} + +/* Strings */ +.chroma .s, +.chroma .sa, +.chroma .sb, +.chroma .sc, +.chroma .dl, +.chroma .sd, +.chroma .s2, +.chroma .se, +.chroma .sh, +.chroma .si, +.chroma .sx, +.chroma .sr, +.chroma .s1, +.chroma .ss { + color: var(--fg); +} + +/* Numbers */ +.chroma .m, +.chroma .mb, +.chroma .mf, +.chroma .mh, +.chroma .mi, +.chroma .il, +.chroma .mo { + color: var(--accent-alpha-70); +} + +/* Types/Classes */ +.chroma .kt, +.chroma .nc, +.chroma .no, +.chroma .nd { + color: var(--secondary); + font-weight: bold; +} + +/* Variables */ +.chroma .nv, +.chroma .vc, +.chroma .vg, +.chroma .vi { + color: var(--secondary); + font-weight: bold; +} + +/* Functions */ +.chroma .nf, +.chroma .fm { + color: var(--secondary-alpha-70); +} + +/* Tags */ +.chroma .nt { + color: var(--accent-alpha-70); +} + +/* Attributes */ +.chroma .na { + color: var(--secondary); +} + +/* Operators */ +.chroma .o, +.chroma .ow { + color: var(--accent-alpha-70); +} diff --git a/site/git/default.nix b/site/git/default.nix @@ -0,0 +1,105 @@ +{ + lib, + pkgs, + site ? "https://git.maydayv7.cc", + repos ? import ./repos.nix, +}: +let + theme = import ./theme.nix pkgs; + buildCommands = lib.concatMapStrings (repo: '' + build_repo "${repo.name}" "${repo.description}" "${repo.owner}" "${repo.url}" "${repo.logo or ""}" + '') repos; +in +pkgs.writeShellApplication { + name = "build-stagit"; + runtimeInputs = with pkgs; [ + coreutils + git + stagit-fork + xhtml1 + ]; + + text = '' + set -e + echo "Building Site..." + + BASE_URL=${site} + OUTPUT_DIR="./public" + FONTS_SRC="./site/static/fonts" + FAVICON_SRC="./site/static/desktop.ico" + + rm -rf "$OUTPUT_DIR" + mkdir -p "$OUTPUT_DIR" + mkdir -p "$OUTPUT_DIR/fonts" + + # 1. Global Assets + echo "Copying Global Assets..." + + # Fonts + if [ -d "$FONTS_SRC" ] + then + cp "$FONTS_SRC"/* "$OUTPUT_DIR/fonts/" + else + echo "Warning: Fonts directory $FONTS_SRC not found." + fi + + # Theme + ls $OUTPUT_DIR + cp "${theme.red}" "$OUTPUT_DIR/style.css" + cp "${theme.red}" "$OUTPUT_DIR/style-red.css" + cp "${theme.blue}" "$OUTPUT_DIR/style-blue.css" + cp "${theme.black}" "$OUTPUT_DIR/style-black.css" + + # Favicon + if [ -f "$FAVICON_SRC" ] + then + cp "$FAVICON_SRC" "$OUTPUT_DIR/favicon.png" + else + echo "Warning: Global favicon not found at $FAVICON_SRC" + fi + + # 2. Build Setup + BUILD_ROOT=$(mktemp -d) + trap 'rm -rf "$BUILD_ROOT"' EXIT + build_repo() { + NAME=$1 + DESC=$2 + OWNER=$3 + URL=$4 + LOGO=$5 + + echo "---------------------------------------" + echo "Processing $NAME..." + REPO_DIR="$BUILD_ROOT/$NAME.git" + git clone --bare "$URL" "$REPO_DIR" + + # Metadata + echo "$DESC" > "$REPO_DIR/description" + echo "$OWNER" > "$REPO_DIR/owner" + echo "$URL" > "$REPO_DIR/url" + + mkdir -p "$OUTPUT_DIR/$NAME" + if [ -n "$LOGO" ] && [ -f "$LOGO" ] + then + cp "$LOGO" "$OUTPUT_DIR/$NAME/logo.png" + fi + + # Run Stagit + (cd "$OUTPUT_DIR/$NAME" && stagit -l 50 -u "$BASE_URL/$NAME" "$REPO_DIR") + + # Link Global Assets + ln -sf ../style.css "$OUTPUT_DIR/$NAME/style.css" + ln -sf ../favicon.png "$OUTPUT_DIR/$NAME/favicon.png" + echo "---------------------------------------" + } + + # 3. Execute Builds + ${buildCommands} + + # 4. Generate Index + echo "Generating Index..." + stagit-index "$BUILD_ROOT"/*.git > "$OUTPUT_DIR/index.html" + + echo "Successfully built to $OUTPUT_DIR!" + ''; +} diff --git a/site/git/index.js b/site/git/index.js @@ -0,0 +1,35 @@ +export default { + async fetch(request, env) { + const url = new URL(request.url); + const cookie = request.headers.get("Cookie") || ""; + + // Theme + if (url.pathname.endsWith("style.css")) { + let theme = "red"; + if (cookie.includes("theme=blue")) theme = "blue"; + if (cookie.includes("theme=black")) theme = "black"; + + const themeUrl = new URL(url); + themeUrl.pathname = themeUrl.pathname.replace( + "style.css", + `style-${theme}.css`, + ); + + let themeResponse = await env.ASSETS.fetch( + new Request(themeUrl, request), + ); + if (themeResponse.ok) return themeResponse; + } + + // Serve assets + let response = await env.ASSETS.fetch(request); + + if (response.ok) { + const newHeaders = new Headers(response.headers); + newHeaders.set("Cache-Control", "public, max-age=60, s-maxage=60"); + return new Response(response.body, { ...response, headers: newHeaders }); + } + + return new Response("Repository not found.", { status: 404 }); + }, +}; diff --git a/site/git/repos.nix b/site/git/repos.nix @@ -0,0 +1,9 @@ +[ + { + name = "matiru"; + url = "https://github.com/maydayv7/matiru"; + description = "Blockchain-Based Supply Chain Transparency for Agricultural Produce"; + owner = "V7"; + logo = ""; + } +] diff --git a/site/git/theme.nix b/site/git/theme.nix @@ -0,0 +1,88 @@ +pkgs: +let + baseCss = builtins.readFile ./base.css; + mkTheme = + name: + { + bg, + fg, + fgDim, + border, + accent, + accentAlpha70, + secondary, + secondaryAlpha70, + diffAdd, + diffDel, + diffMod, + }: + pkgs.writeText "style-${name}.css" '' + ${baseCss} + :root { + --bg: ${bg}; + --fg: ${fg}; + --fg-dim: ${fgDim}; + --border: ${border}; + --border-subtle: rgba(255,255,255,0.05); + + /* Theme Colors */ + --accent: ${accent}; + --accent-alpha-70: ${accentAlpha70}; + --secondary: ${secondary}; + --secondary-alpha-70: ${secondaryAlpha70}; + --bg-hover: rgba(255,255,255,0.03); + --bg-code: rgba(0,0,0,0.2); + --diff-add: ${diffAdd}; + --diff-del: ${diffDel}; + --diff-mod: ${diffMod}; + } + + /* Overrides */ + body { background-color: var(--bg); color: var(--fg); } + a { color: var(--accent); } + a:hover { color: var(--secondary); } + ''; +in +{ + red = mkTheme "red" { + bg = "#221f29"; + fg = "whitesmoke"; + fgDim = "#888888"; + border = "rgba(255,255,255,0.1)"; + accent = "#ff6266"; + accentAlpha70 = "rgba(255, 98, 102, 0.7)"; + secondary = "#23b0ff"; + secondaryAlpha70 = "rgba(35, 176, 255, 0.7)"; + diffAdd = "#23b0ff"; + diffDel = "#ff6266"; + diffMod = "#e59c19"; + }; + + blue = mkTheme "blue" { + bg = "#1d1e28"; + fg = "whitesmoke"; + fgDim = "#888888"; + border = "rgba(255,255,255,0.1)"; + accent = "#23b0ff"; + accentAlpha70 = "rgba(35, 176, 255, 0.7)"; + secondary = "#ee72f1"; + secondaryAlpha70 = "rgba(238, 114, 241, 0.7)"; + diffAdd = "#23b0ff"; + diffDel = "#ee72f1"; + diffMod = "#e59c19"; + }; + + black = mkTheme "black" { + bg = "#1d1d1d"; + fg = "whitesmoke"; + fgDim = "#bbbbbb"; + border = "rgba(255,255,255,0.1)"; + accent = "#7b7b7b"; + accentAlpha70 = "rgba(123, 123, 123, 0.7)"; + secondary = "#e59c19"; + secondaryAlpha70 = "rgba(229, 156, 25, 0.7)"; + diffAdd = "#e59c19"; + diffDel = "#7b7b7b"; + diffMod = "#ffffff"; + }; +} diff --git a/site/git/wrangler.toml b/site/git/wrangler.toml @@ -0,0 +1,14 @@ +name = "site-git" +main = "index.js" +compatibility_date = "2025-12-15" + +[assets] +binding = "ASSETS" +directory = "./public" +not_found_handling = "none" +run_worker_first = true + +[env.production] +routes = [ + { pattern = "git.maydayv7.cc", custom_domain = true } +] diff --git a/site/shell.nix b/site/shell.nix @@ -7,7 +7,7 @@ pkgs.mkShell { packages = with pkgs; [ git zola - lorri + wrangler ]; shellHook = ''echo "## Website Builder Shell ##"''; }