You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.3 KiB

{
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)"
'';
};
}
);
}