nixite/flake.nix

68 lines
1.5 KiB
Nix
Raw Normal View History

2023-12-30 18:27:23 +00:00
{
description = "A site in nix?";
outputs = {
self,
nixpkgs,
}: let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
};
nixite = import ./nixite/. {inherit pkgs;};
in {
2023-12-31 00:48:19 +00:00
serve = nixite.serve;
mkSite = nixite.mkSite;
html = nixite.html;
elems = nixite.elems;
site = nixite.site;
md = nixite.md;
2023-12-31 03:08:05 +00:00
style = nixite.style;
2023-12-31 00:48:19 +00:00
2023-12-31 00:24:48 +00:00
packages.${system} = {
2023-12-31 03:08:41 +00:00
default = nixite.mkSite (nixite.site.applyStyle ./testing/src/style.css {
"index.html" = with nixite.elems; (doc [
2023-12-31 03:08:41 +00:00
[
(title "Nixite")
]
(main [
(nixite.md.readMd ./testing/src/index.md)
(link "/blog" "blog")
(list [
"item 1"
"item 2"
"item 3"
])
])
]);
2023-12-31 03:08:41 +00:00
blog = {
"index.html" = with nixite.elems; (doc [
2023-12-30 18:27:23 +00:00
[
2023-12-31 03:08:41 +00:00
(title "A post")
2023-12-30 18:27:23 +00:00
]
2023-12-31 00:24:48 +00:00
(main [
2023-12-31 03:08:41 +00:00
(p ''
This is a post
'')
(link "/" "Home")
])
]);
2023-12-31 03:08:41 +00:00
};
});
2023-12-30 18:27:23 +00:00
2023-12-31 00:48:19 +00:00
serve = self.serve self.packages.${system}.default;
2023-12-31 00:24:48 +00:00
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}
2023-12-31 03:08:05 +00:00
${test ./testing/style.test.nix}
2023-12-31 00:24:48 +00:00
'';
2023-12-30 18:27:23 +00:00
};
};
}