nixite/flake.nix

62 lines
1.9 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 nixite // {
2023-12-31 09:28:28 +00:00
packages.${system} = {
2024-01-01 06:33:57 +00:00
raw = nixite.mkSite (let
site = (nixite.site.extractPaths {
2024-01-01 00:04:17 +00:00
"test" = with nixite.elems;
2024-01-01 06:33:57 +00:00
let
blue = nixite.style.tag "span" "blue" {
style = { color = "blue"; };
};
underblue = nixite.style.extend blue "under" {
style = { text-decoration = "underline"; };
};
in (Doc { } [
[
2024-01-01 06:33:57 +00:00
(title { } "Nixite")
(link {
rel = "shortcut icon";
type = "image/png";
href = ./testing/src/favicon.png;
} "")
]
2024-01-01 06:33:57 +00:00
(main { } [
(a "/readme" "Readme")
(a "/blog" "blog")
2024-01-01 06:33:57 +00:00
(List { } [ "item 1" "item 2" "item 3" ])
(p { } [
"check out my"
(blue "blue span")
"isn't it"
(underblue "great!")
])
2023-12-31 09:28:28 +00:00
])
]);
2023-12-31 10:33:05 +00:00
blog = nixite.md.readDir ./testing/blog;
2024-01-01 00:04:17 +00:00
"index.html" = nixite.md.mdToPage ./README.md;
2024-01-01 06:33:57 +00:00
});
styles = # nixite.site.getStyles site;
nixite.style.getStyles site.test;
in nixite.site.applyStyle styles site);
2023-12-31 00:48:19 +00:00
2024-01-01 00:04:17 +00:00
default = nixite.serve self.packages.${system}.raw;
2023-12-30 18:27:23 +00:00
2024-01-01 03:20:59 +00:00
test = let run = import ./testing/run.nix pkgs;
in run [
2024-01-01 06:33:57 +00:00
./testing/md.test.nix
2024-01-01 03:20:59 +00:00
./testing/html.test.nix
2024-01-01 06:33:57 +00:00
./testing/elems.test.nix
./testing/site.test.nix
2024-01-01 03:20:59 +00:00
./testing/style.test.nix
];
2023-12-31 09:28:28 +00:00
};
2023-12-30 18:27:23 +00:00
};
}