From a844b21356023f0b6559ee5f45a309c805062478 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 19 Feb 2025 12:30:11 +0000 Subject: [PATCH] Initial commit --- .envrc | 1 + .gitignore | 5 +++++ flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 39 +++++++++++++++++++++++++++++++++++++++ notes.txt | 6 ++++++ run | 25 +++++++++++++++++++++++++ src/_header.html | 1 + src/index.md | 1 + 8 files changed, 105 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 notes.txt create mode 100755 run create mode 100644 src/_header.html create mode 100644 src/index.md diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..527bc02 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# SSG +/dst/ + +# Nix +/result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ccf2a34 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1739866667, + "narHash": "sha256-EO1ygNKZlsAC9avfcwHkKGMsmipUk1Uc0TbrEZpkn64=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "73cf49b8ad837ade2de76f87eb53fc85ed5d4680", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..2167f47 --- /dev/null +++ b/flake.nix @@ -0,0 +1,39 @@ +{ + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + outputs = + { nixpkgs, ... }: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { inherit system; }; + in + { + devShells.${system}.default = pkgs.mkShell { + buildInputs = with pkgs; [ + bashInteractive + lowdown + ]; + }; + + packages.${system} = with pkgs; { + ssg = mkDerivation { + name = "ssg"; + + src = fetchurl { + url = "https://romanzolotarev.com/bin/ssg"; + sha256 = "OgqH4ZQ47EM25ubEpum6v38Tl76hQPh7aZ6VRQcbd2M="; + }; + + dontUnpack = true; + + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/ssg + chmod +x $out/bin/ssg + ''; + }; + }; + + formatter.${system} = pkgs.nixfmt-rfc-style; + }; +} diff --git a/notes.txt b/notes.txt new file mode 100644 index 0000000..be610bc --- /dev/null +++ b/notes.txt @@ -0,0 +1,6 @@ +https://romanzolotarev.com/ssg.html +https://romanzolotarev.com/bin/ssg + +nix build .#ssg +./result/bin/ssg + diff --git a/run b/run new file mode 100755 index 0000000..47fb3c9 --- /dev/null +++ b/run @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +function clean { + rm -fr dst "${@}" + mkdir dst +} + +function generate { + ./result/bin/ssg "src" "dst" "test" "http://localhost" +} + +function help { + printf "%s [args]\n\nTasks:\n" "${0}" + + compgen -A function | grep -v "^_" | cat -n + + printf "\nExtended help:\n Each task has comments for general usage\n" +} + +TIMEFORMAT="Task completed in %3lR" +time "${@:-help}" diff --git a/src/_header.html b/src/_header.html new file mode 100644 index 0000000..8812ba5 --- /dev/null +++ b/src/_header.html @@ -0,0 +1 @@ + diff --git a/src/index.md b/src/index.md new file mode 100644 index 0000000..a1e7613 --- /dev/null +++ b/src/index.md @@ -0,0 +1 @@ +# hello, world!