aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2023-03-18 17:47:19 -0400
committerXe Iaso <me@xeiaso.net>2023-03-18 17:47:19 -0400
commit55c70e63454cd410f075a5dff7a59109a66e9b8a (patch)
tree4f8c296649d26519ab0ddf2be762a67b8aaf798b
parente02edb4eb42ba2c1c397a802c60564436635035d (diff)
downloadx-55c70e63454cd410f075a5dff7a59109a66e9b8a.tar.xz
x-55c70e63454cd410f075a5dff7a59109a66e9b8a.zip
add Iosevka Iaso fonts to XeDN
Signed-off-by: Xe Iaso <me@xeiaso.net>
-rw-r--r--cmd/xedn/index.html9
-rw-r--r--cmd/xedn/main.go10
-rw-r--r--flake.lock78
-rw-r--r--flake.nix32
4 files changed, 118 insertions, 11 deletions
diff --git a/cmd/xedn/index.html b/cmd/xedn/index.html
index 03c4b8e..954c54a 100644
--- a/cmd/xedn/index.html
+++ b/cmd/xedn/index.html
@@ -2,9 +2,8 @@
<html>
<head>
<title>XeDN</title>
- <style>
- main{font-family:monospace,monospace;max-width:38rem;padding:2rem;margin:auto}@media only screen and (max-device-width:736px){main{padding:0}}::selection{background:#d3869b}body{background:#282828;color:#ebdbb2}pre{background-color:#3c3836;padding:1em;border:0}a,a:active,a:visited{color:#b16286;background-color:#1d2021}h1,h2,h3,h4,h5{margin-bottom:.1rem}blockquote{border-left:1px solid #bdae93;margin:.5em 10px;padding:.5em 10px}footer{align:center}@media (prefers-color-scheme:light){body{background:#fbf1c7;color:#3c3836}pre{background-color:#ebdbb2;padding:1em;border:0}a,a:active,a:visited{color:#b16286;background-color:#f9f5d7}h1,h2,h3,h4,h5{margin-bottom:.1rem}blockquote{border-left:1px solid #655c54;margin:.5em 10px;padding:.5em 10px}}
- </style>
+ <link rel="stylesheet" href="/static/css/iosevka/family.css" />
+ <link rel="stylesheet" href="/static/css/xess.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body id="top">
@@ -13,9 +12,7 @@
<p>Hi there! This server is a part of XeDN, the overengineered CDN made by <a href="https://xeiaso.net">Xe Iaso</a>. I hope you're having a good day. This server can't help you much.</p>
- <footer>
- <p>CSS available under the MIT license.</p>
- </footer>
+ <p>From <a href="https://xeiaso.net">Within</a>.</p>
</main>
</body>
</html>
diff --git a/cmd/xedn/main.go b/cmd/xedn/main.go
index eff055a..50127f5 100644
--- a/cmd/xedn/main.go
+++ b/cmd/xedn/main.go
@@ -40,11 +40,20 @@ var (
b2Backend = flag.String("b2-backend", "f001.backblazeb2.com", "Backblaze B2 base host")
addr = flag.String("addr", ":8080", "server address")
dir = flag.String("dir", os.Getenv("XEDN_STATE"), "where XeDN should store cached data")
+ staticDir = flag.String("static-dir", envOr("XEDN_STATIC", "./static"), "where XeDN should look for static assets")
//go:embed index.html
indexHTML []byte
)
+func envOr(name, def string) string {
+ if val, ok := os.LookupEnv(name); ok {
+ return val
+ }
+
+ return def
+}
+
type Cache struct {
ActualHost string
Client *http.Client
@@ -433,6 +442,7 @@ func main() {
mux.Handle("/sticker/", ois)
mux.Handle("/avatar/", sd)
+ mux.Handle("/static/", http.FileServer(http.Dir(*staticDir)))
hdlr := func(w http.ResponseWriter, r *http.Request) {
etagLock.RLock()
diff --git a/flake.lock b/flake.lock
index e1393e8..c52cca2 100644
--- a/flake.lock
+++ b/flake.lock
@@ -23,6 +23,25 @@
"type": "github"
}
},
+ "iaso-fonts": {
+ "inputs": {
+ "nixpkgs": "nixpkgs",
+ "utils": "utils"
+ },
+ "locked": {
+ "lastModified": 1679172980,
+ "narHash": "sha256-B9RMXNbKk6ZY1Xom/3j/psIW7xJIaWTy1hSOplvDjps=",
+ "owner": "Xe",
+ "repo": "iosevka",
+ "rev": "7ff508fdc3b00f822d4b8dcd14f0ed2a5eb302fd",
+ "type": "github"
+ },
+ "original": {
+ "owner": "Xe",
+ "repo": "iosevka",
+ "type": "github"
+ }
+ },
"naersk": {
"inputs": {
"nixpkgs": [
@@ -45,6 +64,21 @@
},
"nixpkgs": {
"locked": {
+ "lastModified": 1678898370,
+ "narHash": "sha256-xTICr1j+uat5hk9FyuPOFGxpWHdJRibwZC+ATi0RbtE=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "ac718d02867a84b42522a0ece52d841188208f2c",
+ "type": "github"
+ },
+ "original": {
+ "id": "nixpkgs",
+ "ref": "nixos-unstable",
+ "type": "indirect"
+ }
+ },
+ "nixpkgs_2": {
+ "locked": {
"lastModified": 1677932085,
"narHash": "sha256-+AB4dYllWig8iO6vAiGGYl0NEgmMgGHpy9gzWJ3322g=",
"owner": "NixOS",
@@ -61,10 +95,12 @@
"root": {
"inputs": {
"gomod2nix": "gomod2nix",
+ "iaso-fonts": "iaso-fonts",
"naersk": "naersk",
- "nixpkgs": "nixpkgs",
+ "nixpkgs": "nixpkgs_2",
"rust-overlay": "rust-overlay",
- "utils": "utils"
+ "utils": "utils_2",
+ "xess": "xess"
}
},
"rust-overlay": {
@@ -92,6 +128,21 @@
},
"utils": {
"locked": {
+ "lastModified": 1678901627,
+ "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "utils_2": {
+ "locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide",
@@ -104,6 +155,29 @@
"repo": "flake-utils",
"type": "github"
}
+ },
+ "xess": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "utils": [
+ "utils"
+ ]
+ },
+ "locked": {
+ "lastModified": 1679175127,
+ "narHash": "sha256-mTqGRswUjVQRL/k1KT9ofIcBSoF/WpJBplO6YSf4X0Y=",
+ "owner": "Xe",
+ "repo": "Xess",
+ "rev": "8f91c6d7d9af16e9241138c49a587b64e9340915",
+ "type": "github"
+ },
+ "original": {
+ "owner": "Xe",
+ "repo": "Xess",
+ "type": "github"
+ }
}
},
"root": "root",
diff --git a/flake.nix b/flake.nix
index f8aa68d..1c02d1a 100644
--- a/flake.nix
+++ b/flake.nix
@@ -21,9 +21,17 @@
inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "utils";
};
+
+ xess = {
+ url = "github:Xe/Xess";
+ inputs.nixpkgs.follows = "nixpkgs";
+ inputs.utils.follows = "utils";
+ };
+
+ iaso-fonts.url = "github:Xe/iosevka";
};
- outputs = { self, nixpkgs, utils, gomod2nix, rust-overlay, naersk }@inputs:
+ outputs = { self, nixpkgs, utils, gomod2nix, rust-overlay, naersk, xess, iaso-fonts }@inputs:
utils.lib.eachSystem [
"x86_64-linux"
"aarch64-linux"
@@ -74,6 +82,21 @@
buildInputs = with pkgs; [ pkg-config libaom libavif ];
};
+ xedn-static = pkgs.stdenvNoCC.mkDerivation {
+ dontUnpack = true;
+ pname = "xedn-static";
+ version = xedn.version;
+
+ buildPhase = ''
+ mkdir -p $out/static/css/iosevka
+
+ ln -s ${xess.packages.${system}.aoi}/static/css/xess.css $out/static/css/xess.css
+ for file in ${iaso-fonts.packages.${system}.default}/*; do
+ ln -s $file $out/static/css/iosevka
+ done
+ '';
+ };
+
robocadey2 = pkgs.buildGoApplication {
pname = "robocadey2";
version = "1.2.3";
@@ -117,7 +140,7 @@
path = "make-mastodon-app";
};
- inherit xedn robocadey2;
+ inherit xedn xedn-static robocadey2;
aegis = copyFile { pname = "aegis"; };
cadeybot = copyFile { pname = "cadeybot"; };
@@ -153,11 +176,12 @@
config = {
Cmd = [ "${xedn}/bin/xedn" ];
WorkingDir = "${xedn}";
+ Env = [ "XEDN_STATIC=${self.packages.${system}.xedn-static}" ];
};
};
};
portable = {
- xedn = let
+ xedn = let
service = pkgs.substituteAll {
name = "xedn.service";
src = ./run/xedn.service.in;
@@ -204,6 +228,8 @@
bloaty
rust
];
+
+ XEDN_STATIC = self.packages.${system}.xedn-static;
};
}) // {
nixosModules = {