diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e1cc70d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.direnv +.envrc +vssm diff --git a/README.md b/README.md index 5700e79..f7d372e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,31 @@ # vssm_full +Build script that produces a single `vssm` binary with the web dashboard (`vssm_web`) embedded. + +## Requirements + +- Go +- Node.js + npm +- git + +***A `flake.nix` is provided for Nix users, run `nix develop` for a shell with all dependencies available.*** + +## Usage + +```sh +./build.sh +``` + +This clones `vssm` and `vssm_web` at the versions pinned in `versions.txt`, builds the frontend, embeds it into the Go binary, and outputs `./vssm`. + +## Versions + +Edit `versions.txt` to pin specific tagged releases of `vssm` and `vssm_web`. + +## Configuration + +See the [vssm README](https://git.bellsworne.tech/chrisbell/vssm) for configuration details, including the config file format, auth tokens, and instance setup. + +## Running as a background service + +*WIP* — instructions for setting up `vssm daemon` as a systemd service (or equivalent) will be added here in the future. diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..d24b988 --- /dev/null +++ b/build.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -euo pipefail + +ORIGINAL_DIR=$(pwd) +source versions.txt + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" EXIT + +echo "Cloning vssm @ $VSSM_VERSION..." +git clone --branch "$VSSM_VERSION" --depth 1 https://git.bellsworne.tech/chrisbell/vssm "$WORKDIR/vssm" + +echo "Cloning vssm_web @ $VSSM_WEB_VERSION..." +git clone --branch "$VSSM_WEB_VERSION" --depth 1 https://git.bellsworne.tech/chrisbell/vssm_web "$WORKDIR/vssm_web" + +echo "Building web frontend..." +cd "$WORKDIR/vssm_web/vssm_web" +npm install +npm run build + +echo "Copying frontend into vssm..." +rm -rf "$WORKDIR/vssm/web/dist" +cp -r dist "$WORKDIR/vssm/web/dist" + +echo "Building vssm binary..." +cd "$WORKDIR/vssm" +go build -o vssm + +echo "Copying binary to output..." +cp vssm "$ORIGINAL_DIR/vssm" + +echo "Done. Binary at ./vssm" diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..366b8c5 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1781074563, + "narHash": "sha256-md8WlXOlfnIeHeOScMTTHFyf2d6iaTwPl2apR5EQ3P4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9ae611a455b90cf061d8f332b977e387bda8e1ca", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..aec686f --- /dev/null +++ b/flake.nix @@ -0,0 +1,47 @@ +{ + description = "Dev shell"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, utils }: + utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; + }; + }; + + dotnetRuntime = pkgs.dotnet-runtime_10.passthru.unwrapped; + in + { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + go + gopls + gotools + delve + golangci-lint + + nodejs_22 + pnpm + + pkgs.dotnet-runtime_10 + patchelf + ]; + + shellHook = '' + export DOTNET_ROOT="${dotnetRuntime}/share/dotnet" + export DOTNET_ROOT_X64="${dotnetRuntime}/share/dotnet" + export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.zlib}/lib:/run/opengl-driver/lib:$LD_LIBRARY_PATH" + + echo " == Dev shell loaded == " + ''; + }; + } + ); +} diff --git a/versions.txt b/versions.txt new file mode 100644 index 0000000..78dfbc9 --- /dev/null +++ b/versions.txt @@ -0,0 +1,2 @@ +VSSM_VERSION=v1.0.0 +VSSM_WEB_VERSION=v1.0.0