forked from Fediversity/fediversity.eu
Compare commits
No commits in common. "c5fad394de3eb316e1f66b8256d3f088bd46f04c" and "0642aef7e9486c9de42dc5baf09743b0327d1b6f" have entirely different histories.
c5fad394de
...
0642aef7e9
4 changed files with 10 additions and 45 deletions
|
@ -36,15 +36,6 @@ rec {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
cmark
|
cmark
|
||||||
npins
|
npins
|
||||||
watchexec
|
|
||||||
];
|
];
|
||||||
shellHook = ''
|
|
||||||
cat << EOF
|
|
||||||
For incremental rebuilds:
|
|
||||||
|
|
||||||
echo watchexec -e nix "nix-build -A build"
|
|
||||||
firefox --new-tab file:///${toString ./.}/result/index.html
|
|
||||||
EOF
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
17
lib.nix
17
lib.nix
|
@ -1,22 +1,7 @@
|
||||||
{ lib }:
|
{ lib }:
|
||||||
rec {
|
rec {
|
||||||
template = g: f: x:
|
template = g: f: x:
|
||||||
let
|
(g (f x)) // { override = o: g (lib.recursiveUpdate (f x) o); };
|
||||||
base = f x;
|
|
||||||
result = g base;
|
|
||||||
in
|
|
||||||
result // {
|
|
||||||
override = new:
|
|
||||||
let
|
|
||||||
# TODO: let overrides take the previous state as an argument
|
|
||||||
# base' = lib.recursiveUpdate base (new base);
|
|
||||||
base' = lib.recursiveUpdate base new;
|
|
||||||
result' = g base';
|
|
||||||
in
|
|
||||||
result' // {
|
|
||||||
override = new: (template g (x': base') x).override new;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Recursively replace occurrences of `from` with `to` within `string`
|
Recursively replace occurrences of `from` with `to` within `string`
|
||||||
|
|
|
@ -31,23 +31,18 @@ in
|
||||||
html = {
|
html = {
|
||||||
# TODO: make authors always a list
|
# TODO: make authors always a list
|
||||||
head.meta.authors = if lib.isList config.author then config.author else [ config.author ];
|
head.meta.authors = if lib.isList config.author then config.author else [ config.author ];
|
||||||
head.title.text = lib.mkForce "yeah";
|
|
||||||
body.content = lib.mkForce [
|
body.content = lib.mkForce [
|
||||||
(cfg.menus.main.outputs.html config)
|
(cfg.menus.main.outputs.html config)
|
||||||
{
|
{
|
||||||
section = {
|
section.heading = {
|
||||||
heading = {
|
# TODO: i18n support
|
||||||
# TODO: i18n support
|
# TODO: structured dates
|
||||||
# TODO: structured dates
|
before = [{ p.content = "Published ${config.date}"; }];
|
||||||
before = [{ p.content = "Published ${config.date}"; }];
|
content = config.title;
|
||||||
content = config.title;
|
after = [{ p.content = "Written by ${config.author}"; }];
|
||||||
after = [{ p.content = "Written by ${config.author}"; }];
|
|
||||||
};
|
|
||||||
content = [
|
|
||||||
(cfg.templates.html.markdown { inherit (config) name body; })
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
(cfg.templates.html.markdown { inherit (config) name body; })
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -64,14 +64,8 @@ in
|
||||||
};
|
};
|
||||||
body.content = [
|
body.content = [
|
||||||
(cfg.menus.main.outputs.html page)
|
(cfg.menus.main.outputs.html page)
|
||||||
{
|
{ section.heading.content = page.title; }
|
||||||
section = {
|
(cfg.templates.html.markdown { inherit (page) name body; })
|
||||||
heading.content = page.title;
|
|
||||||
content = [
|
|
||||||
(cfg.templates.html.markdown { inherit (page) name body; })
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue