Website for Chris & Scotia 2023
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.4 KiB

3 years ago
  1. {
  2. description = "Wedding site for Chris & Scotia 2023.";
  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. myWeddingSiteDir = "$MY_WEDDING_SITE_DIR";
  10. myWeddingSiteTgt = "ubuntu@chrishayward.xyz:/var/www/wedding";
  11. myWeddingSiteTest = pkgs.writeShellScriptBin "wedding-site-test" ''
  12. pushd ${myWeddingSiteDir} > /dev/null &&
  13. ${pkgs.hugo}/bin/hugo -v && ${pkgs.hugo}/bin/hugo server ; \
  14. popd > /dev/null
  15. '';
  16. myWeddingSiteBuild = pkgs.writeShellScriptBin "wedding-site-build" ''
  17. pushd ${myWeddingSiteDir} > /dev/null &&
  18. ${pkgs.hugo}/bin/hugo -v ; \
  19. popd > /dev/null
  20. '';
  21. myWeddingSiteUpdate = pkgs.writeShellScriptBin "wedding-site-update" ''
  22. ${pkgs.rsync}/bin/rsync -aP ${myWeddingSiteDir}/public/ ${myWeddingSiteTgt}
  23. '';
  24. in
  25. rec {
  26. devShells.default = pkgs.mkShell {
  27. buildInputs = with pkgs; [
  28. myWeddingSiteTest
  29. myWeddingSiteBuild
  30. myWeddingSiteUpdate
  31. ];
  32. shellHook = ''
  33. export MY_WEDDING_SITE_DIR="$(pwd)"
  34. '';
  35. };
  36. }
  37. );
  38. }