From 6b8a916cd5220a30f716948da3d1c3e515872c43 Mon Sep 17 00:00:00 2001 From: heyarne Date: Wed, 7 Jul 2021 16:06:47 +0200 Subject: [PATCH] Let there be light --- .envrc | 6 ++++++ .gitignore | 2 ++ flake.lock | 26 ++++++++++++++++++++++++++ flake.nix | 13 +++++++++++++ index.janet | 14 ++++++++++++++ project.janet | 7 +++++++ 6 files changed, 68 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 index.janet create mode 100644 project.janet diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..2369787 --- /dev/null +++ b/.envrc @@ -0,0 +1,6 @@ +use flake + +export JANET_PATH="${PWD}/janet_modules" +mkdir -p $JANET_PATH + +PATH_add "${JANET_PATH}/bin" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ce9687 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +janet_modules/ +site/ diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..db5f9fd --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1625191069, + "narHash": "sha256-M8/UH9pMgQEtuzY9bFwklYw8hx0pOKtUTyQC8E2UTHY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d8079260a3028ae3221d7a5467443ee3a9edd2b8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "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..7a6b1ab --- /dev/null +++ b/flake.nix @@ -0,0 +1,13 @@ +{ + description = "A flake describing the build and dev environment for arnes.space"; + inputs.nixpkgs.url = github:NixOS/nixpkgs; + + outputs = { self, nixpkgs }: let + platform = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${platform}; + in { + devShell.${platform} = pkgs.mkShell { + buildInputs = [ pkgs.janet ]; + }; + }; +} diff --git a/index.janet b/index.janet new file mode 100644 index 0000000..3aa4858 --- /dev/null +++ b/index.janet @@ -0,0 +1,14 @@ +(import janet-html :as html) + +(defn as-html [h] + (html/encode (html/doctype :html5) h)) + +(bagatto/set-output-dir! "site") + +(def img-path-copier (bagatto/path-copier "static")) + +(def data {:dogs {:src (bagatto/* "images/*") + :attrs bagatto/parse-base}}) + +(def site {:index {:dest "index.html" + :out (fn [_] (as-html [:h1 "Hello World!"]))}}) diff --git a/project.janet b/project.janet new file mode 100644 index 0000000..ab2f9c8 --- /dev/null +++ b/project.janet @@ -0,0 +1,7 @@ +(declare-project + :name "arnes.space" + :description "a library that does things" # some example metadata. + + # Optional urls to git repositories that contain required artifacts. + :dependencies ["https://git.sr.ht/~subsetpark/bagatto" + "https://github.com/swlkr/janet-html"])