|
@ -0,0 +1,41 @@ |
|
|
|
|
|
{ |
|
|
|
|
|
description = "Source code for https://chrishayward.xyz"; |
|
|
|
|
|
|
|
|
|
|
|
inputs = { |
|
|
|
|
|
flake-utils.url = "github:numtide/flake-utils"; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
outputs = inputs @ { self, nixpkgs, ... }: |
|
|
|
|
|
inputs.flake-utils.lib.eachDefaultSystem (system: |
|
|
|
|
|
let pkgs = nixpkgs.legacyPackages.${system}; |
|
|
|
|
|
myWebsiteDir = "$MY_WEBSITE_DIR"; |
|
|
|
|
|
myWebsiteTgt = "ubuntu@chrishayward.xyz:/var/www/TODO"; |
|
|
|
|
|
myWebsiteTest = pkgs.writeShellScriptBin "website-test" '' |
|
|
|
|
|
pushd ${myWebsiteDir} > /dev/null && |
|
|
|
|
|
${pkgs.hugo}/bin/hugo -v && ${pkgs.hugo}/bin/hugo server ; \ |
|
|
|
|
|
popd > /dev/null |
|
|
|
|
|
''; |
|
|
|
|
|
myWebsiteBuild = pkgs.writeShellScriptBin "website-build" '' |
|
|
|
|
|
pushd ${myWebsiteDir} > /dev/null && |
|
|
|
|
|
${pkgs.hugo}/bin/hugo -v ; \ |
|
|
|
|
|
popd > /dev/null |
|
|
|
|
|
''; |
|
|
|
|
|
myWebsiteUpdate = pkgs.writeShellScriptBin "website-update" '' |
|
|
|
|
|
${pkgs.rsync}/bin/rsync -aP ${myWebsiteDir}/public/ ${myWebsiteTgt} |
|
|
|
|
|
''; |
|
|
|
|
|
in |
|
|
|
|
|
rec { |
|
|
|
|
|
devShells.default = pkgs.mkShell { |
|
|
|
|
|
buildInputs = with pkgs; [ |
|
|
|
|
|
myWebsiteTest |
|
|
|
|
|
myWebsiteBuild |
|
|
|
|
|
myWebsiteUpdate |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
shellHook = '' |
|
|
|
|
|
export MY_WEBSITE_DIR="$(pwd)" |
|
|
|
|
|
''; |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
} |