feat: made with nix banner

This commit is contained in:
dusk 2021-05-17 04:05:29 +03:00
parent 25e04a0dff
commit 1f928e2a53
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA
2 changed files with 40 additions and 7 deletions

View File

@ -20,7 +20,9 @@
"flakeUtils": [ "flakeUtils": [
"flakeUtils" "flakeUtils"
], ],
"nixpkgs": "nixpkgs" "nixpkgs": [
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1621211208, "lastModified": 1621211208,
@ -38,11 +40,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1621084586, "lastModified": 1621169420,
"narHash": "sha256-raHuJ7ohDLDPqohJzZxhaER7sSh4/1xR6YcUYMj3c3E=", "narHash": "sha256-NKFX7QhxRQkaw0+NjcZ6N+cYpDs7gkpMHxNC8QHkprg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e83b3f3394834c41c0d25017f6808d65c3d6f880", "rev": "c58b97674b12d238d9d21e8ab9ee9d7a6b81ae8f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -55,7 +57,8 @@
"root": { "root": {
"inputs": { "inputs": {
"flakeUtils": "flakeUtils", "flakeUtils": "flakeUtils",
"htmlNix": "htmlNix" "htmlNix": "htmlNix",
"nixpkgs": "nixpkgs"
} }
} }
}, },

View File

@ -3,16 +3,46 @@
htmlNix = { htmlNix = {
url = "github:yusdacra/html.nix"; url = "github:yusdacra/html.nix";
inputs.flakeUtils.follows = "flakeUtils"; inputs.flakeUtils.follows = "flakeUtils";
inputs.nixpkgs.follows = "nixpkgs";
}; };
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flakeUtils.url = "github:numtide/flake-utils"; flakeUtils.url = "github:numtide/flake-utils";
}; };
outputs = { htmlNix, flakeUtils, ... }@inputs: outputs = { htmlNix, flakeUtils, nixpkgs, ... }@inputs:
with flakeUtils.lib; with flakeUtils.lib;
eachDefaultSystem (system: eachDefaultSystem (system:
let let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs.lib) mapAttrsRecursive hasSuffix last;
lib = htmlNix.lib.${system}; lib = htmlNix.lib.${system};
ownTemplater = x: x; ownTemplater = context: context // {
site =
let
headerStyle = with lib.css; css {
"div.botheader" = {
position = "fixed";
padding-bottom = "0.5%";
bottom = 0;
left = 0;
right = 0;
margin-left = "auto";
margin-right = "auto";
text-align = "center";
background = "#111111";
};
};
header = with lib.tags; div { class = "botheader"; }
(a { class = "botheader"; href = "https://github.com/yusdacra/html.nix"; } "made with Nix in html.nix");
in
(
mapAttrsRecursive
(path: value:
if hasSuffix ".html" (last path) then "${value}\n${header}" else value)
context.site
) // { "site.css" = "${context.site."site.css"}\n${headerStyle}"; };
};
site = local: lib.pkgsLib.mkSiteFrom { inherit local; src = ./.; templater = context: ownTemplater (lib.templaters.basic context); }; site = local: lib.pkgsLib.mkSiteFrom { inherit local; src = ./.; templater = context: ownTemplater (lib.templaters.basic context); };
in in
rec { rec {