Add flake.nix with Nix derivations for website and PDF; update workflow to use nix build
Some checks failed
Build and Deploy to Storj / build-and-deploy (push) Failing after 1s
Some checks failed
Build and Deploy to Storj / build-and-deploy (push) Failing after 1s
This commit is contained in:
parent
c7a466de3d
commit
12d1e66c2d
2 changed files with 90 additions and 3 deletions
|
|
@ -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: |
|
||||
|
|
|
|||
79
flake.nix
Normal file
79
flake.nix
Normal file
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue