nixos-homepage
nixos-homepage copied to clipboard
separate source files and build artifacts
Atm the build outputs are stored in the same directory as the source files e.g. nixos-homepage/nixos/options.tt
(source) and nixos-homepage/nixos/options.html
(build output). Then everything seems to be deployed to the live website e.g. http://nixos.org/nixos/options.html and http://nixos.org/nixos/options.tt
It would be nicer to have a directory like build
where all build artifacts are stored. This would also simplify the .gitignore
file and prevent accidental commits of generated files.
I've looked it this make file, it's not as simple as it seems, Make is being used as it was intended, it's tracking the resultant .html files, if there are no change, and the .html files exist, nothing is built!!!..... I presume this was something to do with the neat
[nix-shell]$ fd | entr make
where as any modification to file in the directory, would trigger a rebuild, but only what needs to be rebuilt. It's really a beautiful optimal build system.
if you try repath the output from tpage, then it works, but you end up with make file that constantly builds the page as it can't track the relocated html files.
If this really is an issue, then maybe make should copy of build file to some output directory, and that can be served by the web server???
@nixinator the idea is to have all website related files (html/css/js/...) being created in some other folder (eg. ./build
) and when deploying I will only sync this folder to netlify. Then all the other things will just continue to work. Makes sense?
Sure, I'll send you a PR.
@nixinator also maybe work on top of #454 since removes some resources and we can already avoid conflicts this way.
Ok, i'll take a look at that. I can modify the make file to do a build in place as it works now, and then mv all the artefacts to build/ directory. However, the way 'make' works, it's not great at tracking when files have been moved with mv. If make cant't track these, it can't do conditional rebuilds based on files changing.
The make file builds the website in place as I suspect tools like xsltproc can play havock with relative and absolute paths when processing, so it builds it in the root. Maybe the best course of action is that everything that is created in a .tmp , gets copied to a build/. dir. I'm also loathed to do that too, as in means changing the bootstrapify-docbook.sh and the make file :-( with a cp -r build/ after each step.
I think you can simple track files in in build folder.
for example the following line
HTML = index.html download.html news.html learn.html community.html \
would become
HTML = build/index.html build/download.html build/news.html build/learn.html build/community.html \
Also you would need to add some sections for static resources, example:
favicon.png:
cp $@ build/$@
This may work, however i was trying to have the output directory configurable with OD = someoutputdirectory/
I'm sure is the what xsltproc and tpage work with local and unlocal paths....
rather than prefix build/ everywhere... :-)..
the trick is getting all in one place, and not breaking anything!! :-)