From 12d1e66c2d534369381408703a8e742a5c358253 Mon Sep 17 00:00:00 2001 From: Scott Scoble Date: Tue, 28 Apr 2026 22:49:40 -0700 Subject: [PATCH] Add flake.nix with Nix derivations for website and PDF; update workflow to use nix build --- .forgejo/workflows/deploy.yml | 14 +++++-- flake.nix | 79 +++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 flake.nix diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml index fcffdec..93b312b 100644 --- a/.forgejo/workflows/deploy.yml +++ b/.forgejo/workflows/deploy.yml @@ -12,10 +12,18 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Build + - name: Build website with Nix + run: nix build .#website --no-write-lock-file + + - name: Build speaker profile PDF + run: nix build .#speaker-profile --no-write-lock-file + + - name: Copy build artifacts run: | - npm ci - npm run build + mkdir -p ./dist + cp -r result/* ./dist/ + mkdir -p ./public/downloads + cp result-2/* ./public/downloads/ 2>/dev/null || true - name: Configure rclone run: | diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..598ea37 --- /dev/null +++ b/flake.nix @@ -0,0 +1,79 @@ +{ + description = "Scott Scoble speaker website — Astro + Nix"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + + # The website derivation + website = pkgs.stdenv.mkDerivation { + name = "scott-scoble-website"; + + src = pkgs.lib.cleanSource ./.; + + nativeBuildInputs = with pkgs; [ + nodejs_20 + git + ]; + + configurePhase = '' + export HOME=$(mktemp -d) + ''; + + buildPhase = '' + npm ci + npm run build + ''; + + installPhase = '' + mkdir -p $out + cp -r dist/* $out/ + ''; + + dontPatchShebangs = true; + }; + + # PDF derivation + speaker-profile = pkgs.stdenv.mkDerivation { + name = "scott-scoble-speaker-profile"; + + src = pkgs.lib.cleanSource ./.; + + nativeBuildInputs = with pkgs; [ + typst + ]; + + buildPhase = '' + mkdir -p $out + typst compile one-sheet.typ $out/Scott-Scoble-Human-Cultivation-Expert-Speaker-Profile.pdf + ''; + + installPhase = "true"; + }; + + # Development shell + devShell = pkgs.mkShell { + packages = with pkgs; [ + nodejs_20 + git + rclone + typst + ]; + }; + + in { + packages = { + default = website; + website = website; + speaker-profile = speaker-profile; + }; + + devShells.default = devShell; + }); +}