Split build and push scripts

This commit is contained in:
Stefan 2024-11-26 01:27:27 +00:00
parent 5b72b87a48
commit c91363bd4e
4 changed files with 47 additions and 9 deletions

View file

@ -7,3 +7,4 @@ tasks:
- build: |
cd vegan-prestwich
sh bin/build
sh bin/push

View file

@ -23,12 +23,3 @@ nix-shell -p html-minifier --pure --command "
echo 'Minifying HTML'
html-minifier --input-dir _site --output-dir _site --collapse-whitespace --file-ext html
"
nix-shell -p neocities-cli --command "
echo 'Pushing to Neocities'
set +x
export NEOCITIES_API_KEY=$(cat ~/.neocities/vegan-prestwich)
set -x
neocities push --prune _site
"

10
bin/push Normal file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
nix-shell -p neocities-cli --command "
echo 'Pushing to Neocities'
set +x
export NEOCITIES_API_KEY=$(cat ~/.neocities/vegan-prestwich)
set -x
neocities push --prune _site
"

36
default.nix Normal file
View file

@ -0,0 +1,36 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.stdenv.mkDerivation {
name = "your-website";
src = ./.;
buildInputs = with pkgs; [
sass
lightningcss
nodejs
nodePackages.pnpm
html-minifier
];
# Allow network access during build
__noChroot = true;
buildPhase = ''
mkdir -p _site/style
sass style/style.scss _site/style/style.css
lightningcss --minify --targets '> 0.25%, not IE 11' _site/style/*.css -o _site/style/*.css
# Install dependencies
pnpm install --offline
pnpm eleventy
html-minifier --input-dir _site --output-dir _site --collapse-whitespace --file-ext html
'';
installPhase = ''
mkdir -p $out
cp -r _site/* $out/
'';
}