1
0
website/flake.nix

84 lines
2.2 KiB
Nix
Raw Normal View History

2021-05-16 23:23:08 +03:00
{
inputs = {
htmlNix = {
2022-07-31 09:30:23 +03:00
url = "https://git.gaze.systems/dusk/html.nix/archive/master.zip";
2021-05-16 23:23:08 +03:00
inputs.flakeUtils.follows = "flakeUtils";
2021-05-17 04:05:29 +03:00
inputs.nixpkgs.follows = "nixpkgs";
2021-05-16 23:23:08 +03:00
};
2022-04-10 07:20:52 +03:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2021-05-16 23:23:08 +03:00
flakeUtils.url = "github:numtide/flake-utils";
};
2022-07-30 14:30:02 +03:00
outputs = {
htmlNix,
flakeUtils,
nixpkgs,
...
} @ inputs:
2021-05-16 23:23:08 +03:00
with flakeUtils.lib;
2022-07-30 14:30:02 +03:00
eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
2021-05-17 04:05:29 +03:00
2022-07-30 14:30:02 +03:00
inherit (builtins) readFile;
ssgLib = htmlNix.lib.${system}.pkgsLib;
htmlLib = htmlNix.lib;
2022-07-31 09:30:23 +03:00
aboutContent =
builtins.readFile
(
ssgLib.parseMarkdown
"about.html"
(builtins.readFile ./about.md)
);
2022-07-30 14:30:02 +03:00
site = local:
ssgLib.mkSiteFrom {
inherit local;
src = ./.;
2022-07-31 09:30:23 +03:00
templater = ctx: let
out =
htmlLib.templaters.basic
(
ctx
// {
indexContent = ''
${aboutContent}
<img class="logo" src="resources/gaze-office.webp" style="position: fixed; left: 87%; top: 9%;">
'';
}
);
in
out
// {
site =
out.site
// {
resources."gaze-office.webp" =
./resources/GazeOfficeIcon.webp;
"site.css" = ''
${out.site."site.css"}
${
htmlLib.css.media "max-width: 48em"
{
"img.logo" = {
display = "none";
};
}
}
'';
2022-07-30 14:30:02 +03:00
};
2022-07-31 09:30:23 +03:00
};
2022-07-30 14:30:02 +03:00
};
in rec {
2021-05-16 23:23:08 +03:00
apps = {
website = mkApp {
2022-07-30 14:30:02 +03:00
drv = ssgLib.mkServeFromSite (site true);
2021-05-16 23:23:08 +03:00
name = "serve";
};
};
packages = {
2022-07-30 14:30:02 +03:00
website = ssgLib.mkSitePath (site false);
2021-05-16 23:23:08 +03:00
};
});
}