From 384fc2ca89a93e578e8daaec9d8ca9218e58c610 Mon Sep 17 00:00:00 2001 From: Naomi Roberts Date: Mon, 12 Jan 2026 17:48:14 +0000 Subject: [PATCH] Create site to serve assets Signed-off-by: Naomi Roberts --- .envrc | 1 + .tangled/workflows/create-resourcepack.yml | 52 --------------- .tangled/workflows/deploy.yml | 33 ++++++++++ flake.lock | 27 ++++++++ flake.nix | 76 ++++++++++++++++++++++ site/.gitignore | 11 ++++ site/README.md | 24 +++++++ site/gleam.toml | 24 +++++++ site/manifest.toml | 49 ++++++++++++++ site/src/site.gleam | 5 ++ site/test/site_test.gleam | 13 ++++ 11 files changed, 263 insertions(+), 52 deletions(-) create mode 100644 .envrc delete mode 100644 .tangled/workflows/create-resourcepack.yml create mode 100644 .tangled/workflows/deploy.yml create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 site/.gitignore create mode 100644 site/README.md create mode 100644 site/gleam.toml create mode 100644 site/manifest.toml create mode 100644 site/src/site.gleam create mode 100644 site/test/site_test.gleam 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/.tangled/workflows/create-resourcepack.yml b/.tangled/workflows/create-resourcepack.yml deleted file mode 100644 index 1981d8d..0000000 --- a/.tangled/workflows/create-resourcepack.yml +++ /dev/null @@ -1,52 +0,0 @@ -when: - - event: ["push"] - branch: ["main"] - -engine: nixery - -dependencies: - nixpkgs: - - zip - - openssh - git+https://tangled.org/regnault.dev/spindle-artifact: - - spindle-artifact - -steps: - - name: Setup user - command: | - echo "root:x:0:0::$HOME:/usr/bin/bash" >> /etc/passwd - - - name: Setup SSH - command: | - mkdir -p $HOME/.ssh - echo "$SSH_KEY" > $HOME/.ssh/privkey - chmod 600 $HOME/.ssh/privkey - ssh-keyscan -t rsa tangled.org >> $HOME/.ssh/known_hosts - - - name: Setup SSH repo - command: | - git config --global user.email "mia@naomieow.xyz" - git config --global user.name "Naomi Roberts" - git fetch - git checkout main - git pull --tags - URL=$(git remote get-url origin) - REPO=${URL#*//*/} - git remote set-url origin "git@tangled.org:"$REPO - - - name: Update latest tag - environment: - GIT_SSH_COMMAND: "ssh -i $HOME/.ssh/privkey -o IdentitiesOnly=yes" - command: | - git tag -a latest -m "Latest release" - git push --tags - - - name: Build resourcepack - command: | - pushd resourcepack - zip ../rp.zip ./**/* - popd - - - name: Upload artifact - command: | - ~/.nix-profile/bin/spindle-artifact mc-server latest rp.zip diff --git a/.tangled/workflows/deploy.yml b/.tangled/workflows/deploy.yml new file mode 100644 index 0000000..719c817 --- /dev/null +++ b/.tangled/workflows/deploy.yml @@ -0,0 +1,33 @@ +when: + - event: ["push"] + branch: ["main"] + +engine: "nixery" + +clone: + skip: false + depth: 1 + submodules: false + +environment: + SITE_PATH: "site/dist" + SITE_NAME: "docs-lesbian-skin" + WISP_HANDLE: "lesbian.skin" + +steps: + - name: build site + command: | + nix run .#build + + - name: deploy to wisp + command: | + # Download Wisp CLI + curl https://sites.wisp.place/nekomimi.pet/wisp-cli-binaries/wisp-cli-x86_64-linux -o wisp-cli + chmod +x wisp-cli + + # Deploy to Wisp + ./wisp-cli \ + "$WISP_HANDLE" \ + --path "$SITE_PATH" \ + --site "$SITE_NAME" \ + --password "$ATPROTO_APP_PASSWORD" diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..3e4611c --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1768178648, + "narHash": "sha256-kz/F6mhESPvU1diB7tOM3nLcBfQe7GU7GQCymRlTi/s=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3fbab70c6e69c87ea2b6e48aa6629da2aa6a23b0", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-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..986b374 --- /dev/null +++ b/flake.nix @@ -0,0 +1,76 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + + outputs = {nixpkgs, ...}: let + lib = nixpkgs.lib; + supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; + forEachSupportedSystem = f: + lib.genAttrs supportedSystems (system: + f { + pkgs = import nixpkgs {inherit system;}; + }); + in { + devShells = forEachSupportedSystem ({pkgs}: { + default = pkgs.mkShell { + packages = with pkgs; [ + gleam + beamMinimal28Packages.erlang + beamMinimal28Packages.rebar3 + bun + ]; + }; + }); + apps = forEachSupportedSystem ({pkgs}: let + runtimeInputs = with pkgs; [ + gleam + erlang_28 + beam28Packages.rebar3 + bun + zip + ]; + in { + default = { + type = "app"; + program = "${(pkgs.writeShellApplication { + inherit runtimeInputs; + name = "app"; + text = '' + rm -r site/assets + mkdir -p site/assets/ + cp -r {docs,resourcepack} site/assets/ + + pushd resourcepack + zip ../site/assets/rp.zip ./**/* + popd + + pushd site + ${pkgs.gleam}/bin/gleam run -m lustre/dev start --watch=../ + popd + ''; + })}/bin/app"; + }; + build = { + type = "app"; + program = "${(pkgs.writeShellApplication { + inherit runtimeInputs; + name = "app"; + text = '' + rm -r site/assets + mkdir -p site/assets/ + cp -r {docs,resourcepack} site/assets/ + + pushd resourcepack + zip ../site/assets/rp.zip ./**/* + popd + + pushd site + ${pkgs.gleam}/bin/gleam run -m lustre/dev build --minify + popd + ''; + })}/bin/app"; + }; + }); + }; +} diff --git a/site/.gitignore b/site/.gitignore new file mode 100644 index 0000000..59d0bf5 --- /dev/null +++ b/site/.gitignore @@ -0,0 +1,11 @@ +*.beam +*.ez +/build +erl_crash.dump + +# Added automatically by Lustre Dev Tools +/.lustre +/dist + +# Assets are stored at toplevel and copied over during build time +/assets diff --git a/site/README.md b/site/README.md new file mode 100644 index 0000000..dfcfa4a --- /dev/null +++ b/site/README.md @@ -0,0 +1,24 @@ +# site + +[![Package Version](https://img.shields.io/hexpm/v/site)](https://hex.pm/packages/site) +[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/site/) + +```sh +gleam add site@1 +``` +```gleam +import site + +pub fn main() -> Nil { + // TODO: An example of the project in use +} +``` + +Further documentation can be found at . + +## Development + +```sh +gleam run # Run the project +gleam test # Run the tests +``` diff --git a/site/gleam.toml b/site/gleam.toml new file mode 100644 index 0000000..aa7f531 --- /dev/null +++ b/site/gleam.toml @@ -0,0 +1,24 @@ +name = "site" +version = "1.0.0" + +# Fill out these fields if you intend to generate HTML documentation or publish +# your project to the Hex package manager. +# +# description = "" +# licences = ["Apache-2.0"] +# repository = { type = "github", user = "", repo = "" } +# links = [{ title = "Website", href = "" }] +# +# For a full reference of all the available options, you can have a look at +# https://gleam.run/writing-gleam/gleam-toml/. + +[dependencies] +gleam_stdlib = ">= 0.44.0 and < 2.0.0" +lustre = ">= 5.5.1 and < 6.0.0" + +[dev-dependencies] +gleeunit = ">= 1.0.0 and < 2.0.0" +lustre_dev_tools = ">= 2.3.4 and < 3.0.0" + +[tools.lustre.bin] +bun = "system" diff --git a/site/manifest.toml b/site/manifest.toml new file mode 100644 index 0000000..aa5409f --- /dev/null +++ b/site/manifest.toml @@ -0,0 +1,49 @@ +# This file was generated by Gleam +# You typically do not need to edit this file + +packages = [ + { name = "argv", version = "1.0.2", build_tools = ["gleam"], requirements = [], otp_app = "argv", source = "hex", outer_checksum = "BA1FF0929525DEBA1CE67256E5ADF77A7CDDFE729E3E3F57A5BDCAA031DED09D" }, + { name = "booklet", version = "1.1.0", build_tools = ["gleam"], requirements = [], otp_app = "booklet", source = "hex", outer_checksum = "08E0FDB78DC4D8A5D3C80295B021505C7D2A2E7B6C6D5EAB7286C36F4A53C851" }, + { name = "directories", version = "1.2.0", build_tools = ["gleam"], requirements = ["envoy", "gleam_stdlib", "platform", "simplifile"], otp_app = "directories", source = "hex", outer_checksum = "D13090CFCDF6759B87217E8DDD73A75903A700148A82C1D33799F333E249BF9E" }, + { name = "envoy", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "envoy", source = "hex", outer_checksum = "850DA9D29D2E5987735872A2B5C81035146D7FE19EFC486129E44440D03FD832" }, + { name = "exception", version = "2.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "exception", source = "hex", outer_checksum = "329D269D5C2A314F7364BD2711372B6F2C58FA6F39981572E5CA68624D291F8C" }, + { name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" }, + { name = "gleam_community_ansi", version = "1.4.3", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_regexp", "gleam_stdlib"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "8A62AE9CC6EA65BEA630D95016D6C07E4F9973565FA3D0DE68DC4200D8E0DD27" }, + { name = "gleam_community_colour", version = "2.0.2", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "E34DD2C896AC3792151EDA939DA435FF3B69922F33415ED3C4406C932FBE9634" }, + { name = "gleam_crypto", version = "1.5.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_crypto", source = "hex", outer_checksum = "50774BAFFF1144E7872814C566C5D653D83A3EBF23ACC3156B757A1B6819086E" }, + { name = "gleam_erlang", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "1124AD3AA21143E5AF0FC5CF3D9529F6DB8CA03E43A55711B60B6B7B3874375C" }, + { name = "gleam_http", version = "4.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "82EA6A717C842456188C190AFB372665EA56CE13D8559BF3B1DD9E40F619EE0C" }, + { name = "gleam_httpc", version = "5.0.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_http", "gleam_stdlib"], otp_app = "gleam_httpc", source = "hex", outer_checksum = "C545172618D07811494E97AAA4A0FB34DA6F6D0061FDC8041C2F8E3BE2B2E48F" }, + { name = "gleam_json", version = "3.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "44FDAA8847BE8FC48CA7A1C089706BD54BADCC4C45B237A992EDDF9F2CDB2836" }, + { name = "gleam_otp", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "BA6A294E295E428EC1562DC1C11EA7530DCB981E8359134BEABC8493B7B2258E" }, + { name = "gleam_regexp", version = "1.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_regexp", source = "hex", outer_checksum = "9C215C6CA84A5B35BB934A9B61A9A306EC743153BE2B0425A0D032E477B062A9" }, + { name = "gleam_stdlib", version = "0.68.1", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "F7FAEBD8EF260664E86A46C8DBA23508D1D11BB3BCC6EE1B89B3BC3E5C83FF1E" }, + { name = "gleam_time", version = "1.6.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_time", source = "hex", outer_checksum = "0DF3834D20193F0A38D0EB21F0A78D48F2EC276C285969131B86DF8D4EF9E762" }, + { name = "gleam_yielder", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_yielder", source = "hex", outer_checksum = "8E4E4ECFA7982859F430C57F549200C7749823C106759F4A19A78AEA6687717A" }, + { name = "gleeunit", version = "1.9.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "DA9553CE58B67924B3C631F96FE3370C49EB6D6DC6B384EC4862CC4AAA718F3C" }, + { name = "glint", version = "1.2.1", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_community_colour", "gleam_stdlib", "snag"], otp_app = "glint", source = "hex", outer_checksum = "2214C7CEFDE457CEE62140C3D4899B964E05236DA74E4243DFADF4AF29C382BB" }, + { name = "glisten", version = "8.0.3", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_otp", "gleam_stdlib", "logging", "telemetry"], otp_app = "glisten", source = "hex", outer_checksum = "86B838196592D9EBDE7A1D2369AE3A51E568F7DD2D168706C463C42D17B95312" }, + { name = "gramps", version = "6.0.0", build_tools = ["gleam"], requirements = ["gleam_crypto", "gleam_erlang", "gleam_http", "gleam_stdlib"], otp_app = "gramps", source = "hex", outer_checksum = "8B7195978FBFD30B43DF791A8A272041B81E45D245314D7A41FC57237AA882A0" }, + { name = "group_registry", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_otp", "gleam_stdlib"], otp_app = "group_registry", source = "hex", outer_checksum = "BC798A53D6F2406DB94E27CB45C57052CB56B32ACF7CC16EA20F6BAEC7E36B90" }, + { name = "houdini", version = "1.2.0", build_tools = ["gleam"], requirements = [], otp_app = "houdini", source = "hex", outer_checksum = "5DB1053F1AF828049C2B206D4403C18970ABEF5C18671CA3C2D2ED0DD64F6385" }, + { name = "hpack_erl", version = "0.3.0", build_tools = ["rebar3"], requirements = [], otp_app = "hpack", source = "hex", outer_checksum = "D6137D7079169D8C485C6962DFE261AF5B9EF60FBC557344511C1E65E3D95FB0" }, + { name = "justin", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "justin", source = "hex", outer_checksum = "7FA0C6DB78640C6DC5FBFD59BF3456009F3F8B485BF6825E97E1EB44E9A1E2CD" }, + { name = "logging", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "logging", source = "hex", outer_checksum = "1098FBF10B54B44C2C7FDF0B01C1253CAFACDACABEFB4B0D027803246753E06D" }, + { name = "lustre", version = "5.5.1", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib", "houdini"], otp_app = "lustre", source = "hex", outer_checksum = "CC01AB1108F7A9F1F96E44B00CBF1D38F0AF46FAF4234B81CED0D4C1835DDBB8" }, + { name = "lustre_dev_tools", version = "2.3.4", build_tools = ["gleam"], requirements = ["argv", "booklet", "filepath", "gleam_community_ansi", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_httpc", "gleam_json", "gleam_otp", "gleam_regexp", "gleam_stdlib", "glint", "group_registry", "justin", "lustre", "mist", "polly", "simplifile", "tom", "wisp"], otp_app = "lustre_dev_tools", source = "hex", outer_checksum = "5D5C479E465A3EA018205EFCD2F2FE430A9B9783CAC21670E6CB25703069407D" }, + { name = "marceau", version = "1.3.0", build_tools = ["gleam"], requirements = [], otp_app = "marceau", source = "hex", outer_checksum = "2D1C27504BEF45005F5DFB18591F8610FB4BFA91744878210BDC464412EC44E9" }, + { name = "mist", version = "5.0.4", build_tools = ["gleam"], requirements = ["exception", "gleam_erlang", "gleam_http", "gleam_otp", "gleam_stdlib", "gleam_yielder", "glisten", "gramps", "hpack_erl", "logging"], otp_app = "mist", source = "hex", outer_checksum = "7CED4B2D81FD547ADB093D97B9928B9419A7F58B8562A30A6CC17A252B31AD05" }, + { name = "platform", version = "1.0.0", build_tools = ["gleam"], requirements = [], otp_app = "platform", source = "hex", outer_checksum = "8339420A95AD89AAC0F82F4C3DB8DD401041742D6C3F46132A8739F6AEB75391" }, + { name = "polly", version = "3.0.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_erlang", "gleam_otp", "gleam_stdlib", "simplifile"], otp_app = "polly", source = "hex", outer_checksum = "35B11497B998618CEE216415A7853C3FED3F0F2148DC86BD8FC86B95D67F6DD8" }, + { name = "simplifile", version = "2.3.2", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "E049B4DACD4D206D87843BCF4C775A50AE0F50A52031A2FFB40C9ED07D6EC70A" }, + { name = "snag", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "274F41D6C3ECF99F7686FDCE54183333E41D2C1CA5A3A673F9A8B2C7A4401077" }, + { name = "telemetry", version = "1.3.0", build_tools = ["rebar3"], requirements = [], otp_app = "telemetry", source = "hex", outer_checksum = "7015FC8919DBE63764F4B4B87A95B7C0996BD539E0D499BE6EC9D7F3875B79E6" }, + { name = "tom", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_time"], otp_app = "tom", source = "hex", outer_checksum = "74D0C5A3761F7A7D06994755D4D5AD854122EF8E9F9F76A3E7547606D8C77091" }, + { name = "wisp", version = "2.1.1", build_tools = ["gleam"], requirements = ["directories", "exception", "filepath", "gleam_crypto", "gleam_erlang", "gleam_http", "gleam_json", "gleam_stdlib", "houdini", "logging", "marceau", "mist", "simplifile"], otp_app = "wisp", source = "hex", outer_checksum = "46E2E31DECD61A3748CF6CB317D9AC432BBC8D8A6E65655A9E787BDC69389DE0" }, +] + +[requirements] +gleam_stdlib = { version = ">= 0.44.0 and < 2.0.0" } +gleeunit = { version = ">= 1.0.0 and < 2.0.0" } +lustre = { version = ">= 5.5.1 and < 6.0.0" } +lustre_dev_tools = { version = ">= 2.3.4 and < 3.0.0" } diff --git a/site/src/site.gleam b/site/src/site.gleam new file mode 100644 index 0000000..ada7f1a --- /dev/null +++ b/site/src/site.gleam @@ -0,0 +1,5 @@ +import gleam/io + +pub fn main() -> Nil { + io.println("Hello from site!") +} diff --git a/site/test/site_test.gleam b/site/test/site_test.gleam new file mode 100644 index 0000000..fba3c88 --- /dev/null +++ b/site/test/site_test.gleam @@ -0,0 +1,13 @@ +import gleeunit + +pub fn main() -> Nil { + gleeunit.main() +} + +// gleeunit test functions end in `_test` +pub fn hello_world_test() { + let name = "Joe" + let greeting = "Hello, " <> name <> "!" + + assert greeting == "Hello, Joe!" +} -- 2.51.2