# Back - An extremely simple git bug visualization system. Inspired by TVL's # panettone. # # Copyright (C) 2025 Benedikt Peetz # SPDX-License-Identifier: AGPL-3.0-or-later # # This file is part of Back. # # You should have received a copy of the License along with this program. # If not, see . { pkgs, module, nixos-lib, ... }: nixos-lib.runTest { hostPkgs = pkgs; name = "back"; node = { # Use the nixpkgs as constructed by the `nixpkgs.*` options pkgs = null; }; nodes = { machine = {config, ...}: { environment.systemPackages = [ pkgs.git pkgs.git-bug pkgs.curl ]; imports = [module]; vhack = { back = { enable = true; user = "root"; group = "root"; settings = { scan_path = "/srv/git/repositories"; project_list = "/srv/git/projects.list"; root_url = "https://issues.examplec.com"; }; }; }; }; }; testScript = {nodes, ...}: /* python */ '' start_all() with subtest("Create git-bug issues in owner/repo"): machine.succeed("${pkgs.writeShellScript "setup-git-repo" '' set -ex mkdir --parents /srv/git/repositories cd /srv/git/repositories echo "owner/repo" > /srv/git/projects.list mkdir --parents owner/repo_base cd owner/repo_base git init git bug user new --avatar "" --email "alice@machine.org" --name "alice" --non-interactive git bug bug new \ --title "Some bug title" \ --message "A long description of the bug. Probably has some code segments, maybe even *markdown* mark_up_, or other things" \ --non-interactive git bug bug new \ --title "Second bug title" \ --message "" \ --non-interactive git bug bug new \ --title "Third bug title" \ --message "" \ --non-interactive git bug bug select "$(git bug bug --format plain | awk '{print $1}' | head -n 1)" git bug bug comment new --message "Some message" --non-interactive git bug bug comment new --message "Second comment message" --non-interactive git bug bug label new "Test" git bug bug label new "Test2" cd /srv/git/repositories git clone \ --bare \ --config 'remote.origin.fetch=+refs/bugs/*:refs/bugs/*' \ --config 'remote.origin.fetch=+refs/identities/*:refs/identities/*' \ ./owner/repo_base ./owner/repo.git ''}") with subtest("back machine starts"): machine.wait_for_unit("back.service") with subtest("client can access the machine"): machine.succeed("${pkgs.writeShellScript "curl-back" '' set -xe curl --insecure --fail --show-error "http://127.0.0.1:8000/owner/repo/issues/?query=status:open" --output /root/issues.html grep -- 'Second bug title' /root/issues.html curl --insecure --fail --show-error "http://127.0.0.1:8000/" --output /root/repos.html grep -- 'repo' /root/repos.html grep -- "Unnamed repository; edit this file 'description' to name the repository." /root/repos.html ''} >&2") machine.copy_from_vm("/root/issues.html", ""); machine.copy_from_vm("/root/repos.html", ""); ''; }