feat: use nixpkgs input, add apps for easily running examples
This commit is contained in:
parent
39e4238e67
commit
a69953c97d
@ -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
43
flake.lock
Normal 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
|
||||
}
|
28
flake.nix
28
flake.nix
@ -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
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user