41b526d375
I was using "div" which rounds towards negative infinity, so negative age differences of less than a year had -1 rather than 0 in the years field. |
||
---|---|---|
app | ||
.gitignore | ||
LICENSE | ||
README.org | ||
age.html | ||
caster-age.cabal | ||
default.nix | ||
flake.lock | ||
flake.nix | ||
style.css |
README.org
Display Weathernews caster ages in an HTML table or as plain text: if there's no "TERM" environment variable set, CGI HTML output.
Learning Haskell, so the code might not be the best.
Run nix-build
to build the executable. A "result" directory will be created that's
symlinked to the build result directory in the Nix store. The executable is there. The
link above is actually a symlink to this result symlink, so the latest build is
automatically available on the web. The executable isn't really named "caster-age.cgi";
it's never renamed from it's build name.
Run nix-shell
to get a subshell with the packges specified in "default.nix". Actual
Haskell library dependencies of the executable need to be specified only in the cabal
file. Once in the subshell, run cabal repl
to load the program into ghci and start
experimenting.
UPDATE: This project is now a Nix flake, so to build it, run nix build
; nix develop
for a development shell. Check the nix(1) manual and the official online docs for all the
other flake related commands.
I added this flake to my home-manager config, so now the web app cgi page is symlinked to
~/.nix-profile/bin/caster-age
. I might make a home-manager config repo later.