nixite/flake.nix

68 lines
1.5 KiB
Nix

{
description = "A site in nix?";
outputs = {
self,
nixpkgs,
}: let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
};
nixite = import ./nixite/. {inherit pkgs;};
in {
serve = nixite.serve;
mkSite = nixite.mkSite;
html = nixite.html;
elems = nixite.elems;
site = nixite.site;
md = nixite.md;
style = nixite.style;
packages.${system} = {
default = nixite.mkSite (nixite.site.applyStyle ./testing/src/style.css {
"index.html" = with nixite.elems; (doc [
[
(title "Nixite")
]
(main [
(nixite.md.readMd ./testing/src/index.md)
(link "/blog" "blog")
(list [
"item 1"
"item 2"
"item 3"
])
])
]);
blog = {
"index.html" = with nixite.elems; (doc [
[
(title "A post")
]
(main [
(p ''
This is a post
'')
(link "/" "Home")
])
]);
};
});
serve = self.serve self.packages.${system}.default;
test = let
test = import ./testing/import.nix;
in
pkgs.writeShellScriptBin "test" ''
${test ./testing/md.test.nix}
${test ./testing/html.test.nix}
${test ./testing/elems.test.nix}
${test ./testing/site.test.nix}
${test ./testing/style.test.nix}
'';
};
};
}