style: format entire depot with nixpkgs-fmt

This CL can be used to compare the style of nixpkgs-fmt against other
formatters (nixpkgs, alejandra).

Change-Id: I87c6abff6bcb546b02ead15ad0405f81e01b6d9e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4397
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: lukegb <lukegb@tvl.fyi>
Reviewed-by: wpcarro <wpcarro@gmail.com>
Reviewed-by: Profpatsch <mail@profpatsch.de>
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: tazjin <tazjin@tvl.su>
Reviewed-by: cynthia <cynthia@tvl.fyi>
Reviewed-by: edef <edef@edef.eu>
Reviewed-by: eta <tvl@eta.st>
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2022-01-30 19:06:58 +03:00 committed by tazjin
parent 2d10d60fac
commit aa122cbae7
310 changed files with 7278 additions and 5490 deletions

View file

@ -3,7 +3,7 @@
{
config = {
name = "TVL's blog";
footer = depot.web.tvl.footer {};
footer = depot.web.tvl.footer { };
baseUrl = "https://tvl.fyi/blog";
};

View file

@ -16,9 +16,10 @@ let
(map (p: "cp ${blog.renderPost tvl.blog.config p} $out/blog/${p.key}.html") posts)
);
tvlGraph = runCommandNoCC "tvl.svg" {
nativeBuildInputs = with pkgs; [ fontconfig freetype cairo jetbrains-mono ];
} ''
tvlGraph = runCommandNoCC "tvl.svg"
{
nativeBuildInputs = with pkgs; [ fontconfig freetype cairo jetbrains-mono ];
} ''
${graphviz}/bin/neato -Tsvg ${./tvl.dot} > $out
'';
@ -121,7 +122,8 @@ let
</style>
'';
};
in runCommandNoCC "website" {} ''
in
runCommandNoCC "website" { } ''
mkdir -p $out/blog
cp ${homepage} $out/index.html
${postRenderingCommands tvl.blog.posts}

View file

@ -15,7 +15,7 @@ args: ''
<a class="uncoloured-link" href="https://todo.tvl.fyi/">todos</a>
|
<a class="uncoloured-link" href="https://atward.tvl.fyi/">search</a>
'' + lib.optionalString (args ? extraFooter) args.extraFooter + ''
'' + lib.optionalString (args ? extraFooter) args.extraFooter + ''
</p>
<p class="lod">_</p>
''

View file

@ -21,20 +21,22 @@ let
# Create an animated CSS that equally spreads out the colours over
# the animation duration (1min).
animatedCss = colours: let
# Calculate at which percentage offset each colour should appear.
stepSize = 100 / ((builtins.length colours) - 1);
frames = lib.imap0 (idx: colour: { inherit colour; at = idx * stepSize; }) colours;
frameCss = frame: "${toString frame.at}% { fill: ${frame.colour}; }";
in ''
#armchair-background {
animation: 30s infinite alternate armchairPalette;
}
animatedCss = colours:
let
# Calculate at which percentage offset each colour should appear.
stepSize = 100 / ((builtins.length colours) - 1);
frames = lib.imap0 (idx: colour: { inherit colour; at = idx * stepSize; }) colours;
frameCss = frame: "${toString frame.at}% { fill: ${frame.colour}; }";
in
''
#armchair-background {
animation: 30s infinite alternate armchairPalette;
}
@keyframes armchairPalette {
${lib.concatStringsSep "\n" (map frameCss frames)}
}
'';
@keyframes armchairPalette {
${lib.concatStringsSep "\n" (map frameCss frames)}
}
'';
# Dark version of the logo, suitable for light backgrounds.
darkCss = armchairCss: ''
@ -67,7 +69,8 @@ let
</svg>
'';
in depot.nix.readTree.drvTargets(lib.fix (self: {
in
depot.nix.readTree.drvTargets (lib.fix (self: {
# Expose the logo construction functions.
inherit palette darkCss lightCss animatedCss staticCss;
@ -75,7 +78,7 @@ in depot.nix.readTree.drvTargets(lib.fix (self: {
logoSvg = style: pkgs.writeText "logo.svg" (logoSvg style);
# Create a PNG of the TVL logo with the specified style and DPI.
logoPng = style: dpi: pkgs.runCommandNoCC "logo.png" {} ''
logoPng = style: dpi: pkgs.runCommandNoCC "logo.png" { } ''
${pkgs.inkscape}/bin/inkscape \
--export-area-drawing \
--export-background-opacity 0 \
@ -87,7 +90,8 @@ in depot.nix.readTree.drvTargets(lib.fix (self: {
pastelRainbow = self.logoSvg (darkCss (animatedCss (lib.attrValues palette)));
}
# Add individual outputs for static dark logos of each colour.
// (lib.mapAttrs'
(k: v: lib.nameValuePair "${k}Png"
(self.logoPng (darkCss (staticCss v)) 96)) palette)))
# Add individual outputs for static dark logos of each colour.
// (lib.mapAttrs'
(k: v: lib.nameValuePair "${k}Png"
(self.logoPng (darkCss (staticCss v)) 96))
palette)))

View file

@ -1,6 +1,7 @@
{ depot, pkgs, lib, ... }:
{ # content of the <title> tag
{
# content of the <title> tag
title
# main part of the page, usually wrapped with <main>
, content
@ -17,7 +18,8 @@ let
inherit (depot.tools) cheddar;
in
runCommandNoCC "${lib.strings.sanitizeDerivationName title}-index.html" {
runCommandNoCC "${lib.strings.sanitizeDerivationName title}-index.html"
{
headerPart = ''
<!DOCTYPE html>
<head>
@ -36,11 +38,11 @@ runCommandNoCC "${lib.strings.sanitizeDerivationName title}-index.html" {
inherit content;
footerPart = ''
<hr>
<footer>
${depot.web.tvl.footer args}
</footer>
</body>
<hr>
<footer>
${depot.web.tvl.footer args}
</footer>
</body>
'';
passAsFile = [ "headerPart" "content" "footerPart" ];