summary refs log tree commit diff stats
path: root/modules/by-name/gi/git-server/css.nix
blob: 7d0ad06679a54e04a3764056bef407abfa73db97 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
{
  cgitPkg,
  pkgs,
}: let
  /*
  Adapted from `https://git.qyliss.net/nixlib/sys/atuin.nix`, originally distributed under
  the MIT license.
  */
  cgitCss =
    pkgs.runCommand "cgit-extra.css" {
      licenseHeader = ''
        /*
         * This program is free software: you can redistribute it and/or modify
         * it under the terms of the GNU General Public License v2 as published
         * by the Free Software Foundation.
         *
         * This program is distributed in the hope that it will be useful,
         * but WITHOUT ANY WARRANTY; without even the implied warranty of
         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
         * GNU General Public License for more details.
         *
         * See <https://www.gnu.org/licenses/>.
         */

      '';

      # Adapted from
      # <https://git.causal.agency/src/plain/www/git.causal.agency/custom.css>,
      # distributed as a Larger Work under a Secondary License,
      # as permitted by the terms of the
      # Mozilla Public License Version 2.0.
      extraCss = ''
        * { line-height: 1.25em; }

        article {
          font-family: sans-serif;
          max-width: 70ch;
          margin-left: auto;
          margin-right: auto;
        }

        div#cgit {
          margin: auto;
          font-family: monospace;
          -moz-tab-size: 4;
          tab-size: 4;
          display: table;
        }

        div#cgit table#header {
          margin-left: auto;
          margin-right: auto;
        }
        div#cgit table#header td.logo {
          display: none;
        }
        div#cgit table#header td.main {
          font-size: 1em;
          font-weight: bold;
        }
        div#cgit table#header td.sub {
          border-top: none;
        }
        div#cgit table.tabs {
          margin-left: auto;
          margin-right: auto;
          border-bottom: none;
        }
        div#cgit div.content {
          border-bottom: none;
          min-width: 108ch;
        }
        div#cgit div.content div#summary {
          display: table;
          margin-left: auto;
          margin-right: auto;
        }
        div#cgit div.notes {
          border: none;
          background: transparent;
          padding: 0;
        }
        div#cgit table.list {
          margin-left: auto;
          margin-right: auto;
        }
        div#cgit table.list th a {
          color: inherit;
        }
        div#cgit table.list tr:nth-child(even) {
          background: inherit;
        }
        div#cgit table.list tr:hover {
          background: inherit;
        }
        div#cgit table.list tr.nohover-highlight:hover:nth-child(even) {
          background: inherit;
        }
        div#cgit div.footer {
          font-size: 1em;
          margin-top: 0;
        }

        div#cgit table.blob td.linenumbers:nth-last-child(3) {
          display: none;
        }

        div#cgit table.blob td.linenumbers a:target {
          color: goldenrod;
          text-decoration: underline;
          outline: none;
        }
      '';
      passAsFile = ["licenseHeader" "extraCss"];
    } ''
      cat $licenseHeaderPath ${cgitPkg}/cgit/cgit.css $extraCssPath > $out
    '';
in
  cgitCss