| Add flake.nix pinning hugo via nixpkgs-multiverse df63fc8 Romain Gautier yesterday | 1 | { |
| 2 | description = "mykiwi.blog dev shell"; |
| 3 | |
| 4 | inputs.multiverse.url = "github:fzakaria/nixpkgs-multiverse"; |
| 5 | |
| 6 | outputs = { self, multiverse }: |
| 7 | let |
| 8 | system = "x86_64-linux"; |
| Port fzakaria.com design to Hugo and add a homepage profile 1bdbd06 Romain Gautier 14h ago | 9 | pin = multiverse.multiverse.${system}; |
| 10 | pkgs = pin.tip; |
| 11 | hugo = pin.version "hugo" "0.166.0"; |
| 12 | dart-sass = pin.version "dart-sass" "1.104.0"; |
| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 9h ago | 13 | opentofu = pin.version "opentofu" "1.12.6"; |
| 14 | wrangler = pin.version "wrangler" "4.129.0"; |
| Add flake.nix pinning hugo via nixpkgs-multiverse df63fc8 Romain Gautier yesterday | 15 | in |
| 16 | { |
| Port fzakaria.com design to Hugo and add a homepage profile 1bdbd06 Romain Gautier 14h ago | 17 | packages.${system}.default = pkgs.stdenvNoCC.mkDerivation { |
| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 9h ago | 18 | name = "mykiwi.blog"; |
| Add nix build target and README 1328429 Romain Gautier yesterday | 19 | src = ./blog; |
| Port fzakaria.com design to Hugo and add a homepage profile 1bdbd06 Romain Gautier 14h ago | 20 | nativeBuildInputs = [ hugo dart-sass ]; |
| 21 | buildPhase = '' |
| 22 | HUGO_PARAMS_NIXSTOREPATH="$out" hugo --minify --destination "$out" |
| 23 | ''; |
| Add nix build target and README 1328429 Romain Gautier yesterday | 24 | dontInstall = true; |
| 25 | }; |
| 26 | |
| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 9h ago | 27 | devShells.${system} = { |
| 28 | default = pkgs.mkShell { |
| 29 | name = "mykiwi-blog"; |
| Add flake.nix pinning hugo via nixpkgs-multiverse df63fc8 Romain Gautier yesterday | 30 | |
| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 9h ago | 31 | packages = [ |
| 32 | hugo |
| 33 | dart-sass |
| 34 | ]; |
| Add flake.nix pinning hugo via nixpkgs-multiverse df63fc8 Romain Gautier yesterday | 35 | |
| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 9h ago | 36 | shellHook = '' |
| 37 | dim=$'\033[2m' |
| 38 | reset=$'\033[0m' |
| 39 | printf '%-11s%-9s%s%s%s\n' "Hugo" "$(hugo version | sed -n 's/.*v\([0-9.]*\)+.*/\1/p')" "$dim" "https://github.com/gohugoio/hugo/releases" "$reset" |
| 40 | printf '%-11s%-9s%s%s%s\n' "Dart Sass" "$(sass --version)" "$dim" "https://github.com/sass/dart-sass/releases" "$reset" |
| 41 | ''; |
| 42 | }; |
| 43 | |
| 44 | # Cloudflare provisioning (infra/) - kept separate from the default |
| 45 | # shell so writing a blog post doesn't require pulling in tofu/wrangler. |
| 46 | infra = pkgs.mkShell { |
| 47 | name = "mykiwi-blog-infra"; |
| 48 | |
| 49 | packages = [ |
| 50 | opentofu |
| 51 | wrangler |
| 52 | ]; |
| 53 | |
| 54 | shellHook = '' |
| 55 | dim=$'\033[2m' |
| 56 | reset=$'\033[0m' |
| 57 | printf '%-11s%-9s%s%s%s\n' "OpenTofu" "$(tofu version | sed -n 's/OpenTofu v\([0-9.]*\)/\1/p')" "$dim" "https://github.com/opentofu/opentofu/releases" "$reset" |
| 58 | printf '%-11s%-9s%s%s%s\n' "Wrangler" "$(wrangler --version)" "$dim" "https://github.com/cloudflare/workers-sdk/releases" "$reset" |
| 59 | ''; |
| 60 | }; |
| 61 | }; |
| 62 | |
| 63 | apps.${system} = { |
| 64 | # `nix run .#infra -- plan` / `nix run .#infra -- apply` (or any |
| 65 | # other tofu subcommand) against infra/, from wherever in the repo |
| 66 | # you happen to be. |
| 67 | infra = { |
| 68 | type = "app"; |
| 69 | program = "${pkgs.writeShellApplication { |
| 70 | name = "mykiwi-blog-infra"; |
| 71 | runtimeInputs = [ opentofu pkgs.git ]; |
| 72 | text = '' |
| 73 | root="$(git rev-parse --show-toplevel)" |
| 74 | tofu -chdir="$root/infra" init |
| 75 | tofu -chdir="$root/infra" "$@" |
| 76 | ''; |
| 77 | }}/bin/mykiwi-blog-infra"; |
| 78 | }; |
| 79 | |
| Parallelize make deploy across languages 47c5f42 Romain Gautier 3h ago | 80 | # `nix run .#deploy -- <lang>` - pushes the already-built `./result/<lang>` |
| 81 | # folder (built separately via `make build` / `nix build`, the same |
| 82 | # `packages.default` derivation) to its matching Cloudflare Pages |
| 83 | # project. Needs CLOUDFLARE_API_TOKEN, same as `infra`. Takes a single |
| 84 | # language so the Makefile can fan out `make deploy` across languages |
| 85 | # in parallel via `make -j`. |
| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 9h ago | 86 | deploy = { |
| 87 | type = "app"; |
| 88 | program = "${pkgs.writeShellApplication { |
| 89 | name = "mykiwi-blog-deploy"; |
| Parallelize make deploy across languages 47c5f42 Romain Gautier 3h ago | 90 | runtimeInputs = [ wrangler pkgs.git ]; |
| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 9h ago | 91 | text = '' |
| Parallelize make deploy across languages 47c5f42 Romain Gautier 3h ago | 92 | lang="''${1:?usage: nix run .#deploy -- <lang>}" |
| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 9h ago | 93 | root="$(git rev-parse --show-toplevel)" |
| Parallelize make deploy across languages 47c5f42 Romain Gautier 3h ago | 94 | project="mykiwi-blog-$lang" |
| Move Cloudflare account ID out of .env into wrangler.toml 39fe402 Romain Gautier 3h ago | 95 | wrangler pages deploy "$root/result/$lang" --project-name="$project" --branch=main --config="$root/wrangler.toml" |
| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 9h ago | 96 | ''; |
| 97 | }}/bin/mykiwi-blog-deploy"; |
| 98 | }; |
| Add flake.nix pinning hugo via nixpkgs-multiverse df63fc8 Romain Gautier yesterday | 99 | }; |
| 100 | }; |
| 101 | } |