website/flake.nix

40 lines
1.0 KiB
Nix
Raw Normal View History

2021-05-16 23:23:08 +03:00
{
inputs = {
htmlNix = {
url = "github:yusdacra/html.nix";
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";
};
2021-05-17 04:05:29 +03:00
outputs = { htmlNix, flakeUtils, nixpkgs, ... }@inputs:
2021-05-16 23:23:08 +03:00
with flakeUtils.lib;
eachDefaultSystem (system:
let
2021-05-17 04:05:29 +03:00
pkgs = import nixpkgs { inherit system; };
2021-05-17 04:23:57 +03:00
inherit (pkgs.lib) mapAttrsRecursive hasSuffix last pipe;
2021-05-17 04:05:29 +03:00
2021-05-16 23:23:08 +03:00
lib = htmlNix.lib.${system};
2022-02-17 01:38:28 +03:00
site = local: lib.pkgsLib.mkSiteFrom {
inherit local;
src = ./.;
templater = lib.templaters.basic;
2021-05-17 04:05:29 +03:00
};
2021-05-16 23:23:08 +03:00
in
rec {
apps = {
website = mkApp {
2021-05-17 00:34:46 +03:00
drv = lib.pkgsLib.mkServeFromSite (site true);
2021-05-16 23:23:08 +03:00
name = "serve";
};
};
packages = {
2021-05-17 00:34:46 +03:00
website = lib.pkgsLib.mkSitePath (site false);
2021-05-16 23:23:08 +03:00
};
defaultPackage = packages.website;
defaultApp = apps.website;
});
}