nixite/flake.nix

63 lines
1.9 KiB
Nix
Raw Normal View History

2023-12-30 18:27:23 +00:00
{
description = "A site in nix?";
2024-01-02 09:33:56 +00:00
inputs = { tix.url = "git+https://git.tristans.cloud/tristan/tix"; };
2024-01-02 09:18:30 +00:00
outputs = { self, nixpkgs, tix }:
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
2024-01-01 11:12:37 +00:00
readme = {
2024-01-01 09:43:52 +00:00
name = "readme";
content = nixite.md.mdToPage ./README.md;
};
2024-01-01 08:10:32 +00:00
markup = {
2024-01-01 12:42:18 +00:00
"index.html" = with nixite.elems;
2024-01-01 06:33:57 +00:00
let
2024-01-01 12:42:18 +00:00
blue = nixite.style.component span "blue" {
2024-01-01 06:33:57 +00:00
style = { color = "blue"; };
};
2024-01-01 12:42:18 +00:00
underblue = nixite.style.component blue "under" {
2024-01-01 06:33:57 +00:00
style = { text-decoration = "underline"; };
};
in (Doc { } [
2024-01-01 12:42:18 +00:00
[ (title "Nixite") ]
(main [
(a { href = nixite.site.link readme; } "Readme")
(a "/blog" "blog")
2024-01-01 06:33:57 +00:00
(List { } [ "item 1" "item 2" "item 3" ])
2024-01-01 12:42:18 +00:00
(p [
2024-01-01 06:33:57 +00:00
"check out my"
(blue "blue span")
"isn't it"
2024-01-01 12:42:18 +00:00
(underblue { onclick = "alert(1)"; } "great!")
2024-01-01 06:33:57 +00:00
])
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 08:10:32 +00:00
};
2024-01-01 11:12:37 +00:00
site = (nixite.site.prepare { favicon = ./testing/src/favicon.png; }
markup);
2024-01-01 08:10:32 +00:00
in 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-02 09:18:30 +00:00
test = tix.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
];
2024-01-02 04:01:19 +00:00
2024-01-02 09:18:30 +00:00
watch = tix.watch "nix run .#test --show-trace" "fx";
2024-01-02 04:01:19 +00:00
2024-01-02 09:18:30 +00:00
dev = tix.watch "nix run .# --show-trace" "caddy";
2023-12-31 09:28:28 +00:00
};
2023-12-30 18:27:23 +00:00
};
}