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; + }); +}