Skip to content

Commit e6cf0f0

Browse files
committed
nix-static: add few things I forgot, fix date
1 parent 977e22c commit e6cf0f0

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

blogPosts/nix-as-a-static-site-generator/flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
title = "Nix as a Static Site Generator";
2727
description = "A pathway incremental builds and reproducability";
28-
pubDate = "10 Sep 2023 16:45:00 GMT";
28+
pubDate = "10 Sep 2023 17:31:00 GMT";
2929

3030
name = "nix-as-a-static-site-generator";
3131
src = ./.;

blogPosts/nix-as-a-static-site-generator/main.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,22 @@ So what this does is as follows:
9090
7. the `checkPhase` runs a sanity check using W3C validator `vnu $out/$(slugify ${title}).html` -- this is useful to check that the page was generated OK without actually looking at the file
9191
8. I can now preview the page in the build folder: `open result`
9292

93-
When I'm done, I push this to GitHub.
93+
When I'm done, I run `git add flake.lock` and I push this to GitHub.
9494
This does not include the page on my blog yet, but it creates an URL that I can import.
9595
The URL looks like: `github:jhvst/jhvst.github.io?dir=blogPosts/${title}`.
9696

9797
I then update my main flake which generates my blog, which is found from the project root folder.
9898
This works as follows:
9999

100-
1. add a new import: suppose the name of the entry is foo, then I add `foo.url = "github:jhvst/jhvst.github.io?dir=blogPosts/foo`
101-
2. in the `buildPhase` of my root flake, I add the following lines: `mkdir -p $out/blogPosts/foo` and `cp -r ${inputs.foo.outputs.packages.${system}.default}/* $out/blogPosts/foo` -- this copies the build assets to an URL that I want to have the page
102-
3. I update the `rss.xml` file if I want it to appear in my RSS feed
103-
4. `git commit` and `git push` will trigger a GitHub Action which builds my site, and pushes the resulting build folder to GitHub pages
100+
1. run `nix flake update` so that the new dir folder resolves
101+
2. add a new import: suppose the name of the entry is foo, then I add `foo.url = "github:jhvst/jhvst.github.io?dir=blogPosts/foo`
102+
3. in the `buildPhase` of my root flake, I add the following lines: `mkdir -p $out/blogPosts/foo` and `cp -r ${inputs.foo.outputs.packages.${system}.default}/* $out/blogPosts/foo` -- this copies the build assets to an URL that I want to have the page
103+
4. I update the `rss.xml` file if I want it to appear in my RSS feed
104+
5. `git commit` and `git push` will trigger a GitHub Action which builds my site, and pushes the resulting build folder to GitHub pages
104105

105106
Done.
107+
To see the diffs see: [1)](https://github.com/jhvst/jhvst.github.io/commit/0d1f97099749b98c84ed48f4def454ba850d3672) and [2)](https://github.com/jhvst/jhvst.github.io/commit/977e22ccf238627eea85d6f238ca251bba2a1724).
108+
109+
Somewhat of a downside is that if I want to update my blog post, I always need two git pushes.
110+
However, overall I'm quite happy with my setup and don't see why to go back anymore.
106111

rss.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<title>Nix as a Static Site Generator</title>
1111
<link>https://juuso.dev/blogPosts/nix-as-a-static-site-generator/nix-as-a-static-site-generator.html</link>
1212
<description>A pathway incremental builds and reproducability</description>
13-
<pubDate>10 Sep 2023 16:45:00 GMT</pubDate>
13+
<pubDate>10 Sep 2023 17:31:00 GMT</pubDate>
1414
</item>
1515
<item>
1616
<title>Modular Neovim with Nix</title>

0 commit comments

Comments
 (0)