1
Kākāpō – A web bundler for Nix strings with context
source link: https://github.com/adisbladis/kakapo
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Repository files navigation
Kākāpō
A web bundler for Nix strings with context.
Named after the flightless parrot.
Motivation
Because I'm unwell and and think cursed hacks like //users/sterni/nix/html/README.md are cool and would like to make it's usage more practical.
Basic usage
- Writing a bundle from a derivation
let
indexHTML = writeText "index.html" ''
<h1>Welcome!</h1>
<img src="${./banner.jpg}" />
'';
webRoot = runCommand "webroot" { } ''
mkdir $out
cp ${indexHTML} $out/index.html
'';
in kakapo.makeBundle webRoot;
- Bundling a file tree from an attribute set
kakapo.bundleTree "my-webroot" { } {
"index.html" = ''
<h1>Welcome!</h1>
<img src="${./banner.jpg}" />
'';
}
Use with `htmlNix'
Check out ./templates/htmlNix.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK