Compare commits

...

119 Commits

Author SHA1 Message Date
098bc74008 Update resume
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2025-12-27 00:21:38 +00:00
a6e9a2498f Switch to stable NixOS, update flake.nix, have inputs follow nixpkgs
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2025-12-26 22:41:57 +00:00
41fea82c93 Update blog 2025-04-13 00:57:36 +00:00
ce09d9d7a4 Update resume
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2025-04-08 05:45:55 +00:00
eed8febf6e Update blog 2025-03-31 06:23:16 +00:00
cbe766ea2d Disable minification to avoid weird escaping issues
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2025-03-03 07:37:41 +00:00
1f3a8b9447 Update blog 2025-03-03 06:56:56 +00:00
386062a6a6 Update blog 2025-03-03 03:00:38 +00:00
dc96021ba1 Update to new nixpkgs etc 2025-03-02 21:45:32 +00:00
7814ee7ae2 Subset less aggressively
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2025-02-24 01:05:16 +00:00
4febf06c5c Enable minification in Hugo 2025-02-23 23:10:38 +00:00
c5f6c4a8fa Update blog 2025-02-23 22:44:15 +00:00
37d5bac9d0 Update blog with KaTeX stripping
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2025-02-23 22:38:19 +00:00
ef8369e26a Update blog 2025-02-23 22:16:17 +00:00
d25e8219f2 Update with subsetting scripts 2025-02-23 21:27:50 +00:00
b0ca0f3916 Update resume
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-12-31 00:57:48 +00:00
6b4208003c Update resume
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-12-27 01:26:36 +00:00
15af4fd7cb Update blog 2024-12-26 20:35:36 +00:00
5243e4dffd Update blog 2024-12-26 19:53:55 +00:00
0b5e18dc74 Update blog 2024-12-26 03:08:03 +00:00
03aa7ab07a Update blog 2024-12-26 03:06:05 +00:00
479c5bccae Update blog 2024-12-04 21:59:05 +00:00
57186ed3b4 Update blog 2024-12-02 06:20:13 +00:00
582566cc33 Update blog 2024-11-29 04:41:40 +00:00
86b8966290 Update blog 2024-11-29 04:39:18 +00:00
fe2a356510 Update blog 2024-11-28 00:34:43 +00:00
96ff06fd8b Update blog 2024-11-28 00:30:30 +00:00
90e4e35230 Update blog 2024-11-28 00:29:59 +00:00
fc1d8d5a86 Update blog 2024-11-27 23:14:03 +00:00
338ff7540c Update blog 2024-11-27 20:29:07 +00:00
0d3ac91a55 Update blog 2024-11-27 08:43:03 +00:00
b41d106186 Update blog theme 2024-11-26 03:18:02 +00:00
cc79adb0d2 Update blog 2024-11-16 23:28:39 +00:00
dd5f160246 Update blog 2024-11-16 23:25:59 +00:00
08246ed696 Update blog 2024-11-06 18:44:33 +00:00
4001c236f2 Update with fix for blog
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-11-04 02:00:08 +00:00
68406e3947 Update with new blog posts that use new Bergamot 2024-11-04 01:52:32 +00:00
8546a16acd Update blog 2024-09-16 03:11:41 +00:00
c32e922940 Update blog 2024-09-15 23:39:44 +00:00
eb1710b902 Update blog and bergamot
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-09-15 23:37:02 +00:00
d4d627889a Update with new Bergamot version
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-09-15 17:40:11 +00:00
507a8fa0ea Update blog 2024-08-31 18:38:10 +00:00
0ebeb2f4ff Update blog 2024-08-19 01:07:35 +00:00
3ccd612c87 Update blog 2024-08-19 00:17:08 +00:00
e80bb5010e Update blog 2024-08-19 00:08:06 +00:00
9ea34ddf5f Update blog 2024-08-18 23:31:28 +00:00
6ad81dae17 Update blog 2024-08-18 22:30:47 +00:00
1af36f4ab9 Update blog 2024-08-18 21:14:27 +00:00
fcedeaaa87 Update blog 2024-08-18 21:06:27 +00:00
dea14d236b Update blog 2024-08-09 13:48:51 +00:00
9c7ad6ea08 Update blog 2024-08-09 00:55:10 +00:00
be048c72c6 Update blog 2024-08-09 00:30:38 +00:00
cf1f1c0776 Update blog 2024-08-08 23:45:54 +00:00
eb06a6fd72 Update blog theme 2024-07-16 21:31:37 +00:00
cbaeda55b2 Update blog 2024-07-07 00:53:25 +00:00
d3a47f1884 Update blog 2024-07-07 00:47:28 +00:00
16c4df9a0d Update blog 2024-07-06 03:46:52 +00:00
7dfca96a92 Update blog 2024-07-05 19:10:18 +00:00
ddef357a6a Update blog theme 2024-06-28 05:32:38 +00:00
f6641f5296 Update blog 2024-06-28 05:26:49 +00:00
335ee2545b Update blog theme 2024-06-25 03:01:06 +00:00
1e7a0a28b0 Update blog theme 2024-06-25 02:50:26 +00:00
ec6028dd82 Update the theme and blog
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-25 02:30:50 +00:00
1f62373017 Once again update blog
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-25 01:55:05 +00:00
2dc96c08f4 Update blog with theme changes
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-25 01:39:37 +00:00
77b550fe48 Update theme and publish new post
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-24 01:03:13 +00:00
f992d6e1c8 Update theme
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-20 05:45:13 +00:00
77d55f643c More visual bugfixes from theme
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-20 05:30:57 +00:00
fc7b2c415a Update blog theme
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-20 05:18:49 +00:00
1dcdd8b5f8 Update blog theme
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-20 05:05:59 +00:00
43119e7f5f Update blog
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-20 00:34:05 +00:00
a571954c4d Update blog
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-17 02:46:57 +00:00
25e7e4f2aa Add more draft updates
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-10 02:44:29 +00:00
71c0347943 Update blog source with new draft and theme changes
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-06-10 02:39:26 +00:00
1306acdd21 Update with newer draft of lattices pt. 2
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-31 05:41:38 +00:00
d7f1c91a05 Merge in yet another patch for analyze.rb
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-31 04:08:07 +00:00
a55ea19a98 Pull in analyze.rb bugfix
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-31 03:58:28 +00:00
b87f5c8b5a Update blog
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-31 03:53:08 +00:00
61315cf94a Update blog source with new content graph script
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-30 07:38:59 +00:00
694d2fac14 Update blog source and publish Agda+Hugo
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-30 07:30:58 +00:00
feea668396 Update blog
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-26 06:29:02 +00:00
850ddce3b9 Update blog
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-26 03:45:51 +00:00
9adf19a79e Update blog source
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-25 06:25:14 +00:00
7d6f362936 Avoid using rev in Agda derivation
This might make the derivation more cacheable

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-25 06:06:10 +00:00
f5c1772de0 Test update to blog-source
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-24 20:45:08 +00:00
0962df69ad Factor out building Agda HTML from building the blog
This saves a lot of time since typechecking Agda is slow.

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-24 20:33:34 +00:00
2a86640401 Use duktape to run KaTeX from ruby with Node
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-24 04:23:25 +00:00
fda466a8cf Apply theme bugfix
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-23 07:58:17 +00:00
ee116b138f Add building and linking Agda as build step
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-23 07:37:52 +00:00
abba267fec Update blog
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-23 01:02:07 +00:00
7a1eb96fcc Update blog
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-22 06:54:16 +00:00
3d74e6f5a2 Update blog 2024-05-20 07:40:09 +00:00
7dad80f44d Update blog source with theme fix
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-16 23:17:22 +00:00
9ea42f306b Udjust for blog no longer requiring a generated config file
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-16 23:08:27 +00:00
1c3436fdc3 Update blog source
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-15 04:51:55 +00:00
6b8fa513b4 Update lock to new dependency versions
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-14 02:45:15 +00:00
c1283b0165 Use instable nix pkgs
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2024-05-14 02:43:26 +00:00
9b64a99074 Update the blog with the katex-expression etc. changes. 2023-12-31 03:57:17 +00:00
76e8f1c998 Replace katex-expression with katex as in web-files 2023-12-31 03:50:32 +00:00
abb2e1da3b Update katex-html to fix rendering LaTeX in script tags
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2023-12-30 23:16:42 +00:00
782c9ed45a Include resume in build 2023-12-30 23:09:44 +00:00
df95db0f2d Update flack.lock with recent versions
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
2023-12-30 22:56:39 +00:00
1216263fd8 Patch in more static files from web-files. 2023-12-30 22:54:10 +00:00
f704ceda8d Update web-files version which has newer bergamot. 2023-11-30 07:35:55 +00:00
aebf198ca8 Bundle files from web-files at build time. 2023-11-30 07:09:28 +00:00
ab4b92d031 Remove accidental tabs 2023-04-11 02:54:30 +00:00
211237d9be Remove module in favor of letting system configure nginx 2023-04-11 02:53:15 +00:00
d44e5fc12f Update blog and resume code 2023-02-20 06:57:07 +00:00
d065ca364e Build resume using nix derivation 2023-02-20 05:49:59 +00:00
1b7cf307db Update blog source with diff fixes 2023-01-02 04:54:13 +00:00
65efe9d60b Update blog with fix for double quote issue 2023-01-02 03:55:17 +00:00
aec571a4a5 Update blog version 2023-01-02 00:13:53 +00:00
85373a73b0 Adjust builder for the removal of the graph static directory 2023-01-01 21:34:07 +00:00
e7615c4947 Generate static files as part of the build process 2022-12-30 15:42:32 -08:00
29e03c2732 Update flake.lock 2022-12-30 21:37:01 +00:00
1c0c7355c1 Use Nix function to perform replacement 2022-05-01 20:12:41 +00:00
0f22123471 Update website 2022-04-10 07:54:13 +00:00
67b47d9c29 Properly expose a default package for all operating systems 2022-04-09 22:34:21 +00:00
29c6c9bcba Update blog and use generated submodule configuration 2022-04-09 10:20:02 +00:00
6 changed files with 336 additions and 209 deletions

View File

@@ -1,18 +1,48 @@
source $stdenv/setup
# Set up Ruby to use UTF-8
export RUBYOPT="-KU -E utf-8:utf-8"
# Copy files to a mutable directory.
cp -r $src/* .
# We'll generate some static files so make static writable
# We also store the code HTML files alongside Agda code, so make 'code' writable too
mkdir -p static && chmod -R u+w static code
# Hugo can't set baseUrl via CLI for multi-lingual hosts.
# We have to manually edit the configuration.
sed -i "$urlSub" config.toml
# We host some static files (KaTeX CSS in production) on
# static.danilafe.com. However, we can just bundle them here instead!
# Configure Hugo to do so by writing the expected final paths to config-urls.toml
echo '[params]' >> config-urls.toml
echo 'katexCssUrl = "/katex/katex.min.css"' >> config-urls.toml
echo 'normalizeCssUrl = "/normalize/normalize.css"' >> config-urls.toml
echo 'visNetworkJsUrl = "/vis-network/vis-network.min.js"' >> config-urls.toml
echo 'bergamotJsUrl = "/bergamot/bergamot.js"' >> config-urls.toml
echo 'katexJsUrl = "/katex/katex.min.js"' >> config-urls.toml
echo 'resumeStaticFile = "/Resume-Danila-Fedorin.pdf"' >> config-urls.toml
# Build site with Hugo
hugo $extraFlags
hugo $hugoFlags --config=config.toml,config-urls.toml
# Create/copy generated files
# Can't do submodules because nix flake inputs get their .git deleted
mkdir -p static/graph && ruby ./analyze.rb > static/graph/graph.gen.js # Graph files
stork build --input public/index.toml --output static/index.st # Search index
cp $resume/Resume-Danila-Fedorin.pdf static/Resume-Danila-Fedorin.pdf
cp -r $webFiles/* static/
cp -r $agdaHtml/* code/
# Static folder changed, re-run Hugo
hugo $hugoFlags --config=config.toml,config-urls.toml
# Do post-processing of HTML files: render math, link up Agda code, subset fonts and icons
gendir="public/$publicPath"
htmlfiles=$(find $gendir/ -regex "$gendir/.*\.html")
chmod -R u+w $gendir
echo $htmlfiles | xargs ${gems}/bin/bundle exec ${ruby}/bin/ruby ./convert.rb --katex-js-file static/katex/katex.min.js
echo $htmlfiles | xargs ${gems}/bin/bundle exec ${ruby}/bin/ruby ./agda.rb
echo $htmlfiles | xargs ${gems}/bin/bundle exec ${ruby}/bin/ruby ./chatgpt-subset-feather-icon.rb $gendir/feather-sprite.svg
echo $htmlfiles | xargs python3 chatgpt-subset-one-go.py $gendir/fonts
# Output result
mkdir $out
cp -r public/$publicPath/* $out/
# Render math in HTML and XML files.
find $out/ -regex "$out/.*\.html" | xargs katex-html
cp -r $gendir/* $out/

258
flake.lock generated
View File

@@ -1,13 +1,36 @@
{
"nodes": {
"bergamot-elm": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": [
"web-files",
"nixpkgs"
]
},
"locked": {
"lastModified": 1766788208,
"narHash": "sha256-/P3uz+VNeNOFzI2qSIijy53MpnejO1sWgB+gMqcI2z0=",
"ref": "main",
"rev": "ceca48840efe668fb033b47bc6e415ea4cf9ae85",
"revCount": 97,
"type": "git",
"url": "https://dev.danilafe.com/Everything-I-Know-About-Types/bergamot-elm.git"
},
"original": {
"ref": "main",
"type": "git",
"url": "https://dev.danilafe.com/Everything-I-Know-About-Types/bergamot-elm.git"
}
},
"blog-source": {
"flake": false,
"locked": {
"lastModified": 1648508215,
"narHash": "sha256-H8rF4vpzeNw6Pg/hMtF45UFSm/cHN9HIalDrz+mfpC8=",
"ref": "master",
"rev": "f044082fa53b72a5b8386e42a200ddb8072c7a90",
"revCount": 560,
"lastModified": 1744505804,
"narHash": "sha256-lQtixsVcCSHSpkiYHqqvarxDiI7KekZog907SmUD2W0=",
"ref": "refs/heads/master",
"rev": "7fbd4ea9f83bbb6cc28f069702112961d3cd0e24",
"revCount": 920,
"submodules": true,
"type": "git",
"url": "https://dev.danilafe.com/Web-Projects/blog-static.git"
@@ -18,32 +41,16 @@
"url": "https://dev.danilafe.com/Web-Projects/blog-static.git"
}
},
"blog-source-localized": {
"flake": false,
"locked": {
"lastModified": 1599463261,
"narHash": "sha256-n6e4uRiOsWuOL7DSzbuP9X8cZNLnKOD/2/eOT0aB+Io=",
"ref": "localization",
"rev": "0b5748cc5a19b5d1d78bfcfa58d4027cc10524dd",
"revCount": 367,
"submodules": true,
"type": "git",
"url": "https://dev.danilafe.com/Web-Projects/blog-static.git"
},
"original": {
"ref": "localization",
"submodules": true,
"type": "git",
"url": "https://dev.danilafe.com/Web-Projects/blog-static.git"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1648297722,
"narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
@@ -53,12 +60,15 @@
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1648297722,
"narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
@@ -68,12 +78,15 @@
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1648297722,
"narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
@@ -82,97 +95,150 @@
"type": "github"
}
},
"katex-html": {
"flake-utils_4": {
"inputs": {
"flake-utils": "flake-utils_2",
"katex-server": "katex-server",
"nixpkgs": "nixpkgs_2"
"systems": "systems_4"
},
"locked": {
"lastModified": 1648445866,
"narHash": "sha256-kLqnZXRxmlk3cSx8fA6dvrAVrqOGLzxboPnP5zQ7SQU=",
"ref": "master",
"rev": "dfc582d367ebda79649d339d1edc5476eb0cf954",
"revCount": 13,
"type": "git",
"url": "https://dev.danilafe.com/Nix-Configs/katex-html"
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"type": "git",
"url": "https://dev.danilafe.com/Nix-Configs/katex-html"
}
},
"katex-server": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1648445837,
"narHash": "sha256-llpVUGpy4RQo33B48U3RIz0HBFf2Wqb4SoK1lbeqOjs=",
"ref": "master",
"rev": "2925bd0b2bc5d980eb7b8f79feac28b377a0de13",
"revCount": 6,
"type": "git",
"url": "https://dev.danilafe.com/Nix-Configs/katex-server"
},
"original": {
"type": "git",
"url": "https://dev.danilafe.com/Nix-Configs/katex-server"
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1648444094,
"narHash": "sha256-2liapKh7WXPHELuzLvYK+464g4w9tr9DbNxGuz8XZ98=",
"lastModified": 1766736597,
"narHash": "sha256-BASnpCLodmgiVn0M1MU2Pqyoz0aHwar/0qLkp7CjvSQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "87c74b8120980461a9d4ce8f341551ce0fb50728",
"rev": "f560ccec6b1116b22e6ed15f4c510997d99d5852",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-25.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"resume": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1648444094,
"narHash": "sha256-2liapKh7WXPHELuzLvYK+464g4w9tr9DbNxGuz8XZ98=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "87c74b8120980461a9d4ce8f341551ce0fb50728",
"type": "github"
"lastModified": 1766794825,
"narHash": "sha256-+Fabo0uQF9srEXdi9TB1wjB+PHaU9htXj/fjnvUFNAs=",
"ref": "refs/heads/master",
"rev": "f22cb5b79580020079ba7223346e612b41eb7d42",
"revCount": 74,
"type": "git",
"url": "https://dev.danilafe.com/DanilaFe/resume"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1648444094,
"narHash": "sha256-2liapKh7WXPHELuzLvYK+464g4w9tr9DbNxGuz8XZ98=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "87c74b8120980461a9d4ce8f341551ce0fb50728",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
"type": "git",
"url": "https://dev.danilafe.com/DanilaFe/resume"
}
},
"root": {
"inputs": {
"blog-source": "blog-source",
"blog-source-localized": "blog-source-localized",
"flake-utils": "flake-utils",
"katex-html": "katex-html",
"nixpkgs": "nixpkgs_3"
"nixpkgs": "nixpkgs",
"resume": "resume",
"web-files": "web-files"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"web-files": {
"inputs": {
"bergamot-elm": "bergamot-elm",
"flake-utils": "flake-utils_4",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1766788330,
"narHash": "sha256-7Dx1g0fM/glKCBzo2ZgIwXyp5ASyG/Y7S5OPcltb3Os=",
"ref": "refs/heads/master",
"rev": "407b087a1d0042e04bbcc9333097decd9e776270",
"revCount": 14,
"type": "git",
"url": "https://dev.danilafe.com/Nix-Configs/web-files.git"
},
"original": {
"type": "git",
"url": "https://dev.danilafe.com/Nix-Configs/web-files.git"
}
}
},

View File

@@ -1,35 +1,32 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
flake-utils.url = "github:numtide/flake-utils";
katex-html.url = "git+https://dev.danilafe.com/Nix-Configs/katex-html";
resume.url = "git+https://dev.danilafe.com/DanilaFe/resume";
resume.inputs.nixpkgs.follows = "nixpkgs";
blog-source = {
flake = false;
url = "https://dev.danilafe.com/Web-Projects/blog-static.git";
type = "git";
submodules = true;
};
blog-source-localized = {
flake = false;
url = "https://dev.danilafe.com/Web-Projects/blog-static.git";
ref = "localization";
type = "git";
submodules = true;
};
web-files.url = "git+https://dev.danilafe.com/Nix-Configs/web-files.git";
web-files.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, blog-source, blog-source-localized, nixpkgs, flake-utils, katex-html }:
{
buildersFor = system: import ./lib.nix {
inherit blog-source blog-source-localized;
outputs = { self, blog-source, nixpkgs, flake-utils, resume, web-files }:
flake-utils.lib.eachDefaultSystem (system:
let
lib = import ./lib.nix {
inherit blog-source;
pkgs = import nixpkgs { inherit system; };
katex-html = katex-html.defaultPackage.${system};
};
nixosModule = (import ./module.nix);
packages.x86_64-linux.blog-debug = (import ./lib.nix {
inherit blog-source blog-source-localized;
pkgs = import nixpkgs { system = "x86_64-linux"; };
katex-html = katex-html.defaultPackage."x86_64-linux";
}).english { host = "danilafe.com"; };
resume = resume.defaultPackage.${system};
web-files = web-files.defaultPackage.${system};
};
in
{
inherit lib;
defaultPackage = lib.english { host = "danilafe.com"; };
}
);
}

53
gemset.nix Normal file
View File

@@ -0,0 +1,53 @@
{
duktape = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1nrhvxbhflf2lrd8v4rphsf0lwg0lvfws2i0cpq8s0xxgh4lviia";
type = "gem";
};
version = "2.7.0.0";
};
execjs = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "1yywajqlpjhrj1m43s3lfg3i4lkb6pxwccmwps7qw37ndmphdzg8";
type = "gem";
};
version = "2.9.1";
};
mini_portile2 = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0x8asxl83msn815lwmb2d7q5p29p7drhjv5va0byhk60v9n16iwf";
type = "gem";
};
version = "2.8.8";
};
nokogiri = {
dependencies = ["mini_portile2" "racc"];
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0npx535cs8qc33n0lpbbwl0p9fi3a5bczn6ayqhxvknh9yqw77vb";
type = "gem";
};
version = "1.18.3";
};
racc = {
groups = ["default"];
platforms = [];
source = {
remotes = ["https://rubygems.org"];
sha256 = "0byn0c9nkahsl93y9ln5bysq4j31q8xkf2ws42swighxd4lnjzsa";
type = "gem";
};
version = "1.8.1";
};
}

87
lib.nix
View File

@@ -1,25 +1,67 @@
{ blog-source, blog-source-localized, pkgs, katex-html }:
{ pkgs, blog-source, web-files, resume }:
with pkgs;
with lib;
let
protocol = ssl: if ssl then "https://" else "http://";
gems = settings: bundlerEnv {
inherit ruby;
name = "blog-static-flake";
gemfile = "${settings.src}/Gemfile";
lockfile = "${settings.src}/Gemfile.lock";
gemset = ./gemset.nix;
};
pythonEnv = python3.withPackages (python-pkgs: [
python-pkgs.beautifulsoup4
python-pkgs.lxml
python-pkgs.fonttools
python-pkgs.brotli
]);
# --- Building Agda HTML ---
agdaEnv = agda.withPackages [ agdaPackages.standard-library ];
agdaHtml = settings:
let
# Create content-addresed versions of the scripts in the Nix store to
# avoid throwing off memoization for unrelated changes.
agdaBuildScript = builtins.toFile "build-agda-html.rb" (builtins.readFile "${settings.src}/build-agda-html.rb");
submoduleDataFile = builtins.toFile "submodules.json" (builtins.readFile "${settings.src}/data/submodules.json");
codeRoot = pkgs.lib.cleanSource "${settings.src}/code";
agdaCommand = pkgs.lib.escapeShellArg "agda -l standard-library -i . ";
in
stdenv.mkDerivation {
name = "blog-static-agda-html";
buildInputs = [ ruby agdaEnv ];
builder = builtins.toFile "builder.sh" "
source $stdenv/setup
mkdir -p code $out
cp -r ${codeRoot}/* code/
chmod -R u+w code
ruby ${agdaBuildScript} --data-file=${submoduleDataFile} --target-dir=$out ${agdaCommand}
";
};
website = settings: stdenv.mkDerivation {
inherit (settings) src ssl host;
inherit resume ruby;
name = "blog-static";
version = settings.src.rev;
urlSub =
let
regexEscape = lib.escape [ "/" "(" ")" "[" "]" "+" "*" "\\" ];
in
with settings.replaceUrl; "s/${regexEscape from}/${regexEscape to}/g";
version = settings.src.rev or "dirty";
publicPath = settings.path;
extraFlags = if settings.drafts then " -D " else "";
hugoFlags = concatStringsSep " " (
optionals settings.drafts (singleton "-D") ++
[ "--baseURL=${protocol settings.ssl + settings.host}" ]
);
builder = ./build/builder.sh;
webFiles = web-files;
gems = gems settings;
agdaHtml = agdaHtml settings;
buildInputs = [
hugo katex-html
hugo ruby stork agdaEnv pythonEnv
];
};
wrapHost = ssl: host: (if ssl then "https" else "http") + "://${host}";
in
{
english = settings: website {
@@ -28,20 +70,17 @@ in
drafts = settings.drafts or false;
src = blog-source;
path = ".";
replaceUrl = {
from = "https://danilafe.com";
to = wrapHost (settings.ssl or false) settings.host;
};
};
russian = settings: website {
inherit (settings) host;
ssl = settings.ssl or false;
drafts = settings.drafts or false;
src = blog-source-localized;
path = "ru";
replaceUrl = {
from = "https://ru.danilafe.com";
to = wrapHost (settings.ssl or false) settings.host;
};
virtualHostFor = package:
{
"${package.host}" = mkMerge [
{
root = package;
}
(mkIf (package.ssl) {
forceSSL = true;
enableACME = true;
})
];
};
}

View File

@@ -1,58 +0,0 @@
{ lib, config, ... }:
with lib;
let
cfg = config.services.danilafe-blog;
sslForSite = package: package.ssl;
anySsl = any sslForSite cfg.sites;
virtualHost = package:
{
virtualHosts."${package.host}" = mkMerge [
{
root = package;
}
(mkIf (sslForSite package) {
addSSL = true;
enableACME = true;
acmeRoot = cfg.challengePath;
})
];
};
service = package:
{
# Workaround for new configuration setting all of /var to be readonly.
# See https://github.com/NixOS/nixpkgs/issues/139310
"acme-${package.host}".serviceConfig = {
ReadWritePaths = [ cfg.challengePath ];
};
};
virtualHosts = map virtualHost cfg.sites;
services = map service (filter sslForSite cfg.sites);
in
{
options.services.danilafe-blog = {
enable = mkEnableOption "Daniel's blog service";
sites = mkOption {
type = types.listOf types.package;
default = {};
description = "List of versions of this blog that should be enabled.";
};
challengePath = mkOption {
type = types.str;
description = "The location for ACME challenges.";
};
};
config.services.nginx = mkIf cfg.enable (mkMerge (virtualHosts ++ [
{
# Always enable nginx.
enable = true;
recommendedGzipSettings = true;
}
]));
config.systemd.services = mkIf cfg.enable (mkMerge services);
config.security.acme = mkIf (cfg.enable && anySsl) {
# If any site uses SSL, enable ACME and accept terms.
defaults.email = "danila.fedorin@gmail.com";
acceptTerms = true;
};
}