feat: use nixpkgs input, add apps for easily running examples

This commit is contained in:
dusk 2021-05-15 22:23:14 +03:00
parent 39e4238e67
commit a69953c97d
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA
3 changed files with 86 additions and 27 deletions

View File

@ -1,4 +1,4 @@
{ tags, pkgsLib, pkgs ? import <nixpkgs> { overlays = [ pkgsLib ]; } }:
{ tags, pkgs }:
with pkgs.htmlNix;
let
index = with tags;

43
flake.lock Normal file
View File

@ -0,0 +1,43 @@
{
"nodes": {
"flakeUtils": {
"locked": {
"lastModified": 1620759905,
"narHash": "sha256-WiyWawrgmyN0EdmiHyG2V+fqReiVi8bM9cRdMaKQOFg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b543720b25df6ffdfcf9227afafc5b8c1fabfae8",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1621084586,
"narHash": "sha256-raHuJ7ohDLDPqohJzZxhaER7sSh4/1xR6YcUYMj3c3E=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e83b3f3394834c41c0d25017f6808d65c3d6f880",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flakeUtils": "flakeUtils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@ -1,5 +1,11 @@
{
outputs = { self }:
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flakeUtils.url = "github:numtide/flake-utils";
};
outputs = { self, flakeUtils, nixpkgs }:
flakeUtils.lib.eachDefaultSystem (system:
let
utils = import ./utils.nix;
@ -14,6 +20,8 @@
pkgsLib = (final: prev: {
htmlNix = import ./pkgs-lib.nix { pkgs = prev; utils = utils // { inherit (lib) tags; }; };
});
pkgs = import nixpkgs { inherit system; overlays = [ pkgsLib ]; };
in
{
inherit lib;
@ -22,12 +30,20 @@
inherit pkgsLib;
};
apps = with flakeUtils.lib; {
site = mkApp {
drv = let inherit (pkgs) htmlNix; in
htmlNix.mkServeFromSite (htmlNix.mkSiteFrom { src = ./examples/site; templater = lib.templaters.basic; });
name = "serve";
};
basicServe = mkApp {
drv = import ./examples/serve.nix { inherit (lib) tags; inherit pkgs; };
name = "serve";
};
};
examples = {
siteServe =
let inherit (import <nixpkgs> { overlays = [ pkgsLib ]; }) htmlNix; in
htmlNix.mkServeFromSite (htmlNix.mkSiteFrom { src = ./examples/site; templater = lib.templaters.basic; }); # needs --impure
tags = import ./examples/tags.nix lib.tags;
serve = import ./examples/serve.nix { inherit (lib) tags; inherit pkgsLib; }; # needs --impure
};
};
});
}