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

2 years ago
  1. {
  2. description = "Source code for https://chrishayward.xyz";
  3. inputs = {
  4. flake-utils.url = "github:numtide/flake-utils";
  5. };
  6. outputs = inputs @ { self, nixpkgs, ... }:
  7. inputs.flake-utils.lib.eachDefaultSystem (system:
  8. let pkgs = nixpkgs.legacyPackages.${system};
  9. myWebsiteDir = "$MY_WEBSITE_DIR";
  10. myWebsiteTgt = "ubuntu@chrishayward.xyz:/var/www/TODO";
  11. myWebsiteTest = pkgs.writeShellScriptBin "website-test" ''
  12. pushd ${myWebsiteDir} > /dev/null &&
  13. ${pkgs.hugo}/bin/hugo -v && ${pkgs.hugo}/bin/hugo server ; \
  14. popd > /dev/null
  15. '';
  16. myWebsiteBuild = pkgs.writeShellScriptBin "website-build" ''
  17. pushd ${myWebsiteDir} > /dev/null &&
  18. ${pkgs.hugo}/bin/hugo -v ; \
  19. popd > /dev/null
  20. '';
  21. myWebsiteUpdate = pkgs.writeShellScriptBin "website-update" ''
  22. ${pkgs.rsync}/bin/rsync -aP ${myWebsiteDir}/public/ ${myWebsiteTgt}
  23. '';
  24. in
  25. rec {
  26. devShells.default = pkgs.mkShell {
  27. buildInputs = with pkgs; [
  28. myWebsiteTest
  29. myWebsiteBuild
  30. myWebsiteUpdate
  31. ];
  32. shellHook = ''
  33. export MY_WEBSITE_DIR="$(pwd)"
  34. '';
  35. };
  36. }
  37. );
  38. }