diff --git a/.envrc b/.envrc new file mode 100755 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100755 index 0000000..ca36994 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,32 @@ +name: Releases +on: + push: + branches: + - 'main' + tags: + - 'release-*' + workflow_dispatch: +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install Nix + uses: cachix/install-nix-action@v30 + - name: Build Project + shell: bash + run: | + sh build.sh + - uses: ncipollo/release-action@v1 + with: + artifacts: "result/pdf/*" + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: "result/site/*" + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..2338a6c --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*_files +.quarto +.direnv +build +result +out +_book* +*.html +site_libs diff --git a/README.md b/README.md new file mode 100644 index 0000000..3c1333e --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# The Local Bylaws of the Beta Nu chapter of Theta Chi + +This repository contains the source code for the Local Bylaws of our fraternity. + +The source is primarily written in Quarto Markdown (.qmd). Documentation is available on Quarto's website. + +## Contributing + +Fork and clone this repository, then create a pull request to update information or alternatively use the GitHub web editor. + +## Releasing + +To create a release, tag a commit with "release-{version}" and merge this commit into the `main` branch. The GitHub action will automatically build and deploy the release. + +## Help + +If you are in need of help, contact a member of EC, Trevor Nichols @tnichols217, or Ben Koeppen @bnkoeppen \ No newline at end of file diff --git a/build.nix b/build.nix new file mode 100755 index 0000000..e6ece3c --- /dev/null +++ b/build.nix @@ -0,0 +1,19 @@ +{ stdenv, buildenv, ... }: +stdenv.mkDerivation { + pname = "BetaNuLBL"; + version = "0.0.1"; + + src = ./src; + + nativeBuildInputs = buildenv; + + buildPhase = '' + export HOME=$(pwd) + quarto render --no-cache + ''; + + installPhase = '' + mkdir -p $out + cp -r _book/* $out + ''; +} \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..4d92001 --- /dev/null +++ b/build.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +nix bundle --experimental-features "nix-command flakes" .#deploy \ No newline at end of file diff --git a/deploy.nix b/deploy.nix new file mode 100644 index 0000000..a77f330 --- /dev/null +++ b/deploy.nix @@ -0,0 +1,13 @@ +{ src, stdenv, ... }: +stdenv.mkDerivation { + inherit src; + name = "GH-Action-builder"; + buildInputs = [ ]; + + installPhase = '' + mkdir -p $out/pdf + mkdir -p $out/site + mv *.pdf $out/pdf + mv * $out/site + ''; +} \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100755 index 0000000..df45477 --- /dev/null +++ b/flake.lock @@ -0,0 +1,129 @@ +{ + "nodes": { + "flake-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" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1666603677, + "narHash": "sha256-apAEIj+z1iwMaMJ4tB21r/VTetfGDLDzuhXRHJknIAU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "074da18a72269cc5a6cf444dce42daea5649b2fe", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1739446958, + "narHash": "sha256-+/bYK3DbPxMIvSL4zArkMX0LQvS7rzBKXnDXLfKyRVc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2ff53fe64443980e139eaa286017f53f88336dd0", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1735554305, + "narHash": "sha256-zExSA1i/b+1NMRhGGLtNfFGXgLtgo+dcuzHzaWA6w3Q=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "0e82ab234249d8eee3e8c91437802b32c74bb3fd", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs_2", + "treefmt-nix": "treefmt-nix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1738953846, + "narHash": "sha256-yrK3Hjcr8F7qS/j2F+r7C7o010eVWWlm4T1PrbKBOxQ=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "4f09b473c936d41582dd744e19f34ec27592c5fd", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100755 index 0000000..76fecf3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,67 @@ +{ + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + treefmt-nix.url = "github:numtide/treefmt-nix"; + gitignore.url = "github:hercules-ci/gitignore.nix"; + }; + outputs = {...} @ inputs: + inputs.flake-utils.lib.eachDefaultSystem ( + system: let + pkgs = (import inputs.nixpkgs) { + inherit system; + config = { + # allowUnfree = true; + # allowBroken = true; + }; + }; + rpkgs = with pkgs.rPackages; [ + stringr + stringi + ]; + p = with pkgs; [ + podman-compose + podman + (quarto.override { + extraRPackages = rpkgs; + }) + (rWrapper.override { + packages = rpkgs; + }) + texliveFull + texworks + texstudio + ]; + in { + devShells = rec { + rShell = pkgs.mkShell { + packages = p; + }; + default = rShell; + }; + formatter = let + treefmtconfig = inputs.treefmt-nix.lib.evalModule pkgs { + projectRootFile = "flake.nix"; + programs = { + toml-sort.enable = true; + yamlfmt.enable = true; + mdformat.enable = true; + prettier.enable = true; + shellcheck.enable = true; + shfmt.enable = true; + }; + settings.formatter.shellcheck.excludes = [".envrc"]; + settings.formatter.mdformat.includes = ["*.qmd"]; + }; + in + treefmtconfig.config.build.wrapper; + apps = rec { + }; + packages = rec { + book = pkgs.callPackage ./build.nix { buildenv = p; }; + deploy = pkgs.callPackage ./deploy.nix { src = book; }; + default = book; + }; + } + ); +} diff --git a/scripts/glossary.r b/scripts/glossary.r new file mode 100755 index 0000000..d78fb48 --- /dev/null +++ b/scripts/glossary.r @@ -0,0 +1,19 @@ +files <- strsplit(Sys.getenv("QUARTO_PROJECT_INPUT_FILES")[1], "\n")[[1]] +glossary <- readLines("glossary.qmd") +terms <- glossary[stringr::str_detect(glossary, "^## ")] |> + stringr::str_remove_all("## ") |> + stringi::stri_replace_all_regex("\\{*\\}", "") +print(files) + +for (f in files) { + if (f != "glossary.qmd") { + co <- readLines(f) + if (any(stringr::str_detect(co, paste0(terms, collapse = "|")))) { + print(f) + print(terms) + co <- stringi::stri_replace_all_regex(co, paste0("(?