aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configuration.nix (renamed from nix/configuration.nix)12
-rw-r--r--flake.nix8
-rw-r--r--git/cgit.scss27
-rw-r--r--git/default.nix (renamed from nix/git.nix)16
-rw-r--r--git/theme.nix20
-rw-r--r--nix/site.nix23
-rw-r--r--nix/web.nix36
-rw-r--r--site/sass/style.scss22
-rw-r--r--style/_fonts.scss (renamed from site/sass/_fonts.scss)0
-rw-r--r--style/_palette.scss (renamed from site/sass/_palette.scss)0
10 files changed, 141 insertions, 23 deletions
diff --git a/nix/configuration.nix b/configuration.nix
index 96c5e48..9477c6f 100644
--- a/nix/configuration.nix
+++ b/configuration.nix
@@ -1,11 +1,11 @@
{config, ...}: {
imports = [
- ./hardware-configuration.nix
- ./minecraft.nix
- ./options.nix
- ./git.nix
- ./ssh.nix
- ./web.nix
+ ./git
+ ./nix/hardware-configuration.nix
+ ./nix/minecraft.nix
+ ./nix/options.nix
+ ./nix/ssh.nix
+ ./nix/web.nix
];
boot.loader = {
diff --git a/flake.nix b/flake.nix
index 05ea6bf..7c3b59d 100644
--- a/flake.nix
+++ b/flake.nix
@@ -9,9 +9,15 @@
outputs = inputs: {
nixosConfigurations.kassouni-net = inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
- modules = [ ./nix/configuration.nix ];
+ modules = [ ./configuration.nix ];
};
+ packages = builtins.mapAttrs (system: pkgs: rec {
+ website = import ./nix/site.nix { inherit pkgs; };
+ cgit-theme = import ./git/theme.nix { inherit pkgs; };
+ default = website;
+ }) inputs.nixpkgs.legacyPackages;
+
devShells = builtins.mapAttrs (system: pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
diff --git a/git/cgit.scss b/git/cgit.scss
new file mode 100644
index 0000000..3d0c4fb
--- /dev/null
+++ b/git/cgit.scss
@@ -0,0 +1,27 @@
+// Stylesheet for cgit on git.kassouni.net, layered over cgit's stock cgit.css.
+// Rules here have to match `div#cgit ...` to win on specificity, so they nest
+// under the same id. Compiled by ./theme.nix.
+@use "fonts";
+
+div#cgit {
+ font-family: fonts.$mono;
+
+ // cgit.css asks for generic `monospace` on these; point them at the webfont
+ a.ls-blob,
+ a.ls-dir,
+ .ls-mod,
+ .oid,
+ div.commit-msg,
+ div.notes,
+ table.bin-blob th,
+ table.bin-blob td,
+ table.diff td,
+ table.list td.commitgraph,
+ table.list td.logmsg,
+ table.list td.logsubject,
+ table.ssdiff td,
+ td.ls-mode,
+ td.ls-size {
+ font-family: fonts.$mono;
+ }
+}
diff --git a/nix/git.nix b/git/default.nix
index 4b3b493..f46c3ab 100644
--- a/nix/git.nix
+++ b/git/default.nix
@@ -1,6 +1,7 @@
-{config, pkgs, ...}: let
+{config, inputs, pkgs, ...}: let
domain = "git.kassouni.net";
repoRoot = "/srv/git";
+ theme = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.cgit-theme;
in {
users.users.git = {
isSystemUser = true;
@@ -28,6 +29,8 @@ in {
group = "git"; # so cgit can traverse a non-world-readable repoRoot
gitHttpBackend.checkExportOkFiles = true;
settings = {
+ # cgit adds one <link> per css entry, in order
+ css = [ "/cgit.css" "/theme.css" ];
strict-export = "git-daemon-export-ok";
remove-suffix = true;
readme = [ ":README.md" ":README" ":readme.md" ];
@@ -40,12 +43,9 @@ in {
services.nginx.virtualHosts.${domain} = {
forceSSL = true;
enableACME = true;
+ locations = {
+ "= /theme.css".alias = "${theme}/theme.css";
+ "/fonts/".alias = "${theme}/fonts/";
+ };
};
-
- security.acme = {
- acceptTerms = true;
- defaults.email = "alex@kassouni.net";
- };
-
- networking.firewall.allowedTCPPorts = [ 80 443 ];
}
diff --git a/git/theme.nix b/git/theme.nix
new file mode 100644
index 0000000..4d4a395
--- /dev/null
+++ b/git/theme.nix
@@ -0,0 +1,20 @@
+{ pkgs }:
+
+# The extra stylesheet for cgit, served next to cgit's stock cgit.css, plus the
+# webfont it references. Fonts ship here rather than being pulled from
+# kassouni.net so they stay same-origin and need no CORS headers.
+pkgs.runCommand "cgit-theme"
+ {
+ nativeBuildInputs = [ pkgs.dart-sass ];
+
+ meta = {
+ description = "cgit stylesheet matching kassouni.net";
+ license = pkgs.lib.licenses.mit;
+ platforms = pkgs.lib.platforms.all;
+ };
+ }
+ ''
+ mkdir -p $out
+ sass --no-source-map --load-path=${../style} ${./cgit.scss} $out/theme.css
+ cp -r ${../site/static/fonts} $out/fonts
+ ''
diff --git a/nix/site.nix b/nix/site.nix
new file mode 100644
index 0000000..45209ff
--- /dev/null
+++ b/nix/site.nix
@@ -0,0 +1,23 @@
+{ pkgs }:
+
+pkgs.stdenvNoCC.mkDerivation {
+ pname = "kassouni-net";
+ version = "0.1.0";
+
+ # style/ sits outside the zola project because cgit shares its partials
+ src = pkgs.lib.fileset.toSource {
+ root = ../.;
+ fileset = pkgs.lib.fileset.unions [ ../site ../style ];
+ };
+
+ nativeBuildInputs = [ pkgs.zola ];
+
+ buildPhase = "zola --root site build";
+ installPhase = "cp -r site/public $out";
+
+ meta = {
+ description = "The personal website of Alex Kassouni";
+ license = pkgs.lib.licenses.mit;
+ platforms = pkgs.lib.platforms.all;
+ };
+}
diff --git a/nix/web.nix b/nix/web.nix
index b34f8d8..0013d4f 100644
--- a/nix/web.nix
+++ b/nix/web.nix
@@ -1,8 +1,32 @@
-{...}: {
- # dont serve git.kassouni.net traffic to other subdomains
- services.nginx.virtualHosts."_" = {
- default = true;
- rejectSSL = true;
- locations."/".return = 444;
+{inputs, pkgs, ...}: let
+ domain = "kassouni.net";
+in {
+ services.nginx = {
+ enable = true;
+ recommendedGzipSettings = true;
+ recommendedOptimisation = true;
+ recommendedTlsSettings = true;
+
+ virtualHosts = {
+ # dont serve kassouni.net traffic to other subdomains
+ "_" = {
+ default = true;
+ rejectSSL = true;
+ locations."/".return = 444;
+ };
+
+ ${domain} = {
+ forceSSL = true;
+ enableACME = true;
+ root = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.website;
+ };
+ };
};
+
+ security.acme = {
+ acceptTerms = true;
+ defaults.email = "alex@${domain}";
+ };
+
+ networking.firewall.allowedTCPPorts = [ 80 443 ];
}
diff --git a/site/sass/style.scss b/site/sass/style.scss
index 5ce9f88..1daba2d 100644
--- a/site/sass/style.scss
+++ b/site/sass/style.scss
@@ -1,5 +1,6 @@
-@use "palette";
-@use "fonts";
+// shared with the cgit stylesheet, hence the reach out of the zola project
+@use "../../style/palette";
+@use "../../style/fonts";
body {
background: var(--bg);
@@ -102,6 +103,23 @@ time {
color: var(--fg-dim);
}
+h1, h2, h3, h4, h5, h6 {
+ line-height: 1.3;
+
+ &::before {
+ color: var(--grey);
+ font-weight: 400;
+ margin-right: 0.4em;
+ }
+}
+
+h1::before { content: "#"; }
+h2::before { content: "##"; }
+h3::before { content: "###"; }
+h4::before { content: "####"; }
+h5::before { content: "#####"; }
+h6::before { content: "######"; }
+
strong {
color: var(--orange);
font-weight: 600;
diff --git a/site/sass/_fonts.scss b/style/_fonts.scss
index 2299bca..2299bca 100644
--- a/site/sass/_fonts.scss
+++ b/style/_fonts.scss
diff --git a/site/sass/_palette.scss b/style/_palette.scss
index b61eb94..b61eb94 100644
--- a/site/sass/_palette.scss
+++ b/style/_palette.scss