From 073d876fcfa7afe2150765b7242419364e030ef2 Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Sun, 11 Dec 2022 18:09:02 +0000 Subject: [PATCH] Add xess --- assets/style.css | 4 ---- flake.lock | 53 +++++++++++++++++++++++++++++++++++++++++++- flake.nix | 8 ++++++- src/main.rs | 7 +++--- static/css/theme.css | 8 +++++++ 5 files changed, 71 insertions(+), 9 deletions(-) delete mode 100644 assets/style.css create mode 100644 static/css/theme.css diff --git a/assets/style.css b/assets/style.css deleted file mode 100644 index d779fce..0000000 --- a/assets/style.css +++ /dev/null @@ -1,4 +0,0 @@ -body { - background-color: black; - color: white; -} diff --git a/flake.lock b/flake.lock index 3eb3c5f..d647379 100644 --- a/flake.lock +++ b/flake.lock @@ -85,11 +85,28 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1640319671, + "narHash": "sha256-ZkKmakwaOaLiZOpIZWbeJZwap5CzJ30s4UJTfydYIYc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "eac07edbd20ed4908b98790ba299250b5527ecdf", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "crane": "crane", "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "xess": "xess" } }, "rust-overlay": { @@ -116,6 +133,40 @@ "repo": "rust-overlay", "type": "github" } + }, + "utils": { + "locked": { + "lastModified": 1638122382, + "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "xess": { + "inputs": { + "nixpkgs": "nixpkgs_2", + "utils": "utils" + }, + "locked": { + "lastModified": 1667763126, + "narHash": "sha256-wKn3q3hICvEfs0m3CaeJmLCSyWVuVw/5LgDdh3QSXkU=", + "owner": "Xe", + "repo": "Xess", + "rev": "882799a25ce4fa4df014ad701aaa5a9b23ff9e85", + "type": "github" + }, + "original": { + "owner": "Xe", + "repo": "Xess", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 9f33491..cd33348 100644 --- a/flake.nix +++ b/flake.nix @@ -10,9 +10,11 @@ }; flake-utils.url = "github:numtide/flake-utils"; + + xess.url = "github:Xe/Xess"; }; - outputs = { self, nixpkgs, crane, flake-utils, ... }: + outputs = { self, nixpkgs, crane, flake-utils, xess, ... }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { @@ -42,6 +44,10 @@ drv = my-crate; }; + packages = { + xess = xess.packages.${system}.customized ./static/css/theme.css; + }; + devShells.default = pkgs.mkShell { inputsFrom = builtins.attrValues self.checks; diff --git a/src/main.rs b/src/main.rs index d3584c9..533eb79 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ use std::{boxed, error}; use dkregistry::v2::Client; use maud::{html, Markup, DOCTYPE}; use axum::{Router, routing::get}; -use futures::{stream::{StreamExt, self}, future::join_all}; +use futures::{stream::StreamExt, future::join_all}; use axum_extra::routing::SpaRouter; // To be expanded upon. @@ -21,9 +21,10 @@ async fn main() { // build our application with a single route let app = Router::new() .route("/", get(root)) - .merge(SpaRouter::new("/assets", "assets")); + .merge(SpaRouter::new("/static", "/static")); // run it with hyper on localhost:3000 + println!("Running webserver on port :3000"); axum::Server::bind(&"0.0.0.0:3000".parse().unwrap()) .serve(app.into_make_service()) .await @@ -35,7 +36,7 @@ fn header(page_title: &str) -> Markup { (DOCTYPE) meta charset="utf-8"; title { (page_title) } - link rel="stylesheet" href="/assets/style.css"; + link rel="stylesheet" href="/static/css/style.css"; } } diff --git a/static/css/theme.css b/static/css/theme.css new file mode 100644 index 0000000..d676358 --- /dev/null +++ b/static/css/theme.css @@ -0,0 +1,8 @@ +:root { + --background-color: 0; + --text-color: 43; + --accent-color: 344; + + --width: 80ch; + --padding: 0; +}