diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 439f36c..dacfe74 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,3 @@ - name: Deploy to Gihub Pages on: @@ -16,24 +15,17 @@ jobs: submodules: true fetch-depth: 0 lfs: true - - name: Checkout LFS objects - run: git lfs checkout - - - name: Setup Hugo - uses: peaceiris/actions-hugo@v2 - with: - hugo-version: 'latest' - extended: true - - - name: Build - run: hugo --minify + - name: Install Nix + uses: cachix/install-nix-action@v17 + - name: Build site + run: nix build - name: Deploy uses: peaceiris/actions-gh-pages@v3 if: github.ref == 'refs/heads/main' with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./public + publish_dir: ./result cname: allthingsembedded.com deploy-staging: @@ -47,19 +39,15 @@ jobs: - name: Checkout LFS objects run: git lfs checkout - - name: Setup Hugo - uses: peaceiris/actions-hugo@v2 - with: - hugo-version: 'latest' - extended: true - - - name: Build - run: hugo --minify -D --baseURL https://allthingsembedded.com/staging-web + - name: Install Nix + uses: cachix/install-nix-action@v17 + - name: Build site + run: nix build .#allthingsembedded-staging - name: Deploy uses: peaceiris/actions-gh-pages@v3 if: github.ref == 'refs/heads/main' with: - publish_dir: ./public + publish_dir: ./result external_repository: allthingsembedded/staging-web personal_token: ${{ secrets.PERSONAL_TOKEN }} diff --git a/.gitignore b/.gitignore index e6369ba..a3c6297 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ public/ .direnv .hugo_build.lock result/ +nix-portable diff --git a/.gitmodules b/.gitmodules index 5b48215..ad9251e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "themes/even"] path = themes/even - url = https://github.com/allthingsembedded/hugo-theme-even + url = https://github.com/olOwOlo/hugo-theme-even diff --git a/config.toml b/config.toml index f153966..8f9bcce 100644 --- a/config.toml +++ b/config.toml @@ -14,9 +14,10 @@ pygmentsCodefences = true pygmentsUseClasses = true pygmentsCodefencesGuessSyntax = true -paginate = 5 googleAnalytics = "UA-120967880-1" # UA-XXXXXXXX-X +[pagination] +pagerSize = 5 [sitemap] # essential changefreq = "weekly" diff --git a/flake.nix b/flake.nix index a1882b2..6fbd91c 100644 --- a/flake.nix +++ b/flake.nix @@ -31,28 +31,45 @@ in fn pkgs ); + + buildHugoPackage = { pkgs, pname, version, src, extraBuildArgs ? "" }: (pkgs.stdenvNoCC.mkDerivation { + inherit pname version src; + + nativeBuildInputs = [ + pkgs.hugo + ]; + + patchPhase = '' + mkdir -p themes/ + cp -r ${even-theme}/ themes/even + ''; + + buildPhase = '' + hugo ${extraBuildArgs} + ''; + + installPhase = '' + cp -r public $out + ''; + }); + in { packages = forEachSystem (pkgs: rec { - allthingsembedded = pkgs.stdenvNoCC.mkDerivation { + allthingsembedded = buildHugoPackage { + inherit pkgs; pname = "allthingsembedded"; version = "1.0.0"; - src = self; + extraBuildArgs = "--minify"; + }; - nativeBuildInputs = [ - pkgs.hugo - ]; - - buildPhase = '' - mkdir -p themes/even/ - cp -r ${even-theme} themes/even - hugo - ''; - - installPhase = '' - cp -r public $out - ''; + allthingsembedded-staging = buildHugoPackage { + inherit pkgs; + pname = "allthingsembedded"; + version = "1.0.0"; + src = self; + extraBuildArgs = "--minify -D --baseURL https://allthingsembedded.com/staging-web"; }; default = allthingsembedded; diff --git a/portable_build.sh b/portable_build.sh new file mode 100755 index 0000000..c86e5d9 --- /dev/null +++ b/portable_build.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +curl -L https://github.com/DavHau/nix-portable/releases/latest/download/nix-portable-$(uname -m) > ./nix-portable +chmod +x ./nix-portable + +./nix-portable nix build +./nix-portable nix-shell -p bash --run "cp -rL result public" diff --git a/themes/even b/themes/even index 50b4d1e..e030809 160000 --- a/themes/even +++ b/themes/even @@ -1 +1 @@ -Subproject commit 50b4d1e2eb1736b31b916cc4fef813b6f5b40141 +Subproject commit e03080913d6148d055471f76027a33f28234cb32