Compare commits

...

4 Commits

10 changed files with 1893 additions and 60 deletions

1766
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

8
Cargo.toml Normal file
View File

@ -0,0 +1,8 @@
[workspace]
members = [
"dashboard",
"fluent-ergonomics",
"geo-types",
"ifc",
"memorycache",
]

30
build.sh Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -euo pipefail
RUST_ALL_TARGETS="dashboard ifc memorycache geo-types fluent-ergonomics"
build_rust_targets() {
local CMD=$1
local TARGETS=${@/$CMD}
for target in $TARGETS; do
MODULE=$target CMD=$CMD ./builders/rust.sh
done
}
export CARGO=`which cargo`
if [ -z "${TARGET-}" ]; then
TARGET="all"
fi
if [ -z "${CMD-}" ]; then
CMD="release"
fi
if [ "${TARGET}" == "all" ]; then
build_rust_targets $CMD $RUST_ALL_TARGETS
else
build_rust_targets $CMD $TARGET
fi

33
builders/rust.sh Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -euo pipefail
if [ ! -z "$MODULE" ]; then
MODULE="-p $MODULE"
fi
if [ -z "${PARAMS-}" ]; then
PARAMS=""
fi
case $CMD in
build)
$CARGO build $MODULE $PARAMS
;;
test)
$CARGO test $MODULE $PARAMS
;;
release)
$CARGO build --release $MODULE $PARAMS
;;
clean)
$CARGO clean $MODULE
;;
"")
echo "No command specified. Use build | test | release | clean"
;;
*)
echo "$CMD is unknown. Use build | test | release | clean"
;;
esac

View File

@ -15,7 +15,7 @@ lazy_static = { version = "1.4" }
unic-langid = { version = "0.9" } unic-langid = { version = "0.9" }
horrorshow = { version = "0.8" } horrorshow = { version = "0.8" }
http = { version = "*" } http = { version = "*" }
international-fixed-calendar = { path = "../ifc/" } ifc = { path = "../ifc/" }
memorycache = { path = "../memory_cache" } memorycache = { path = "../memory_cache" }
reqwest = { version = "0.11", features = ["json"] } reqwest = { version = "0.11", features = ["json"] }
serde_derive = { version = "1" } serde_derive = { version = "1" }

View File

@ -10,7 +10,7 @@ use fluent::{FluentArgs, FluentValue};
use geo_types::{Latitude, Longitude}; use geo_types::{Latitude, Longitude};
use horrorshow::helper::doctype; use horrorshow::helper::doctype;
use horrorshow::prelude::*; use horrorshow::prelude::*;
use international_fixed_calendar as IFC; use ifc;
use std::{ use std::{
borrow::Cow, borrow::Cow,
net::{IpAddr, Ipv4Addr, SocketAddr}, net::{IpAddr, Ipv4Addr, SocketAddr},
@ -58,7 +58,7 @@ autumn_equinox = Aŭtuna Ekvinokso
winter_solstice = Vintra Solstico winter_solstice = Vintra Solstico
"; ";
fn date(fluent: Arc<fluent_ergonomics::FluentErgo>, today: IFC::IFC) -> impl Render { fn date(fluent: Arc<fluent_ergonomics::FluentErgo>, today: ifc::IFC) -> impl Render {
let mut day_args = FluentArgs::new(); let mut day_args = FluentArgs::new();
day_args.set( day_args.set(
"day", "day",
@ -126,7 +126,7 @@ fn astronomia_eventa_desegno(
/* /*
fn page_template( fn page_template(
fluent: Arc<fluent_ergonomics::FluentErgo>, fluent: Arc<fluent_ergonomics::FluentErgo>,
today: IFC::IFC, today: ifc::IFC,
sun_moon: SunMoon, sun_moon: SunMoon,
event: Option<solstices::Event>, event: Option<solstices::Event>,
) -> String { ) -> String {
@ -156,7 +156,7 @@ async fn page(
longitude: Longitude, longitude: Longitude,
) -> Result<Html<String>, Rejection> { ) -> Result<Html<String>, Rejection> {
let now = Utc::now(); let now = Utc::now();
let d = IFC::IFC::from(now.with_timezone(&New_York).date()); let d = ifc::IFC::from(now.with_timezone(&New_York).date());
let sun_moon = solar_client let sun_moon = solar_client
.request(latitude, longitude, now.with_timezone(&New_York).date()) .request(latitude, longitude, now.with_timezone(&New_York).date())
.await; .await;
@ -170,7 +170,7 @@ async fn page(
#[tokio::main] #[tokio::main]
pub async fn main() { pub async fn main() {
let now = Local::now(); let now = Local::now();
let ifc = IFC::IFC::from(now.date_naive().with_year(12023).unwrap()); let ifc = ifc::IFC::from(now.date_naive().with_year(12023).unwrap());
let next_event = EVENTS.next_event(now.with_timezone(&Utc)).unwrap(); let next_event = EVENTS.next_event(now.with_timezone(&Utc)).unwrap();
println!( println!(

View File

@ -46,56 +46,52 @@
]; ];
LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib"; LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib";
}; };
packages."x86_64-linux" = # packages."x86_64-linux" =
let # let
pkgs = import nixpkgs { system = "x86_64-linux"; }; # pkgs = import nixpkgs { system = "x86_64-linux"; };
standardOverride = attrs: { # standardOverride = attrs: {
nativeBuildInputs = [ # nativeBuildInputs = [
pkgs.pkg-config # pkgs.pkg-config
pkgs.gtk4 # pkgs.gtk4
]; # ];
verbose = true; # verbose = true;
}; # };
customBuildInfo = pkgs: pkgs.buildRustCrate.override { # customBuildInfo = pkgs: pkgs.buildRustCrate.override {
defaultCrateOverrides = pkgs.defaultCrateOverrides // { # defaultCrateOverrides = pkgs.defaultCrateOverrides // {
cairo-sys-rs = standardOverride; # cairo-sys-rs = standardOverride;
graphene-sys = standardOverride; # graphene-sys = standardOverride;
gobject-sys = standardOverride; # gobject-sys = standardOverride;
pango-sys = standardOverride; # pango-sys = standardOverride;
gio-sys = standardOverride; # gio-sys = standardOverride;
gdk-pixbuf-sys = standardOverride; # gdk-pixbuf-sys = standardOverride;
gdk4-sys = standardOverride; # gdk4-sys = standardOverride;
gsk4-sys = standardOverride; # gsk4-sys = standardOverride;
gtk4-sys = standardOverride; # gtk4-sys = standardOverride;
kifu-gtk = attrs: { # kifu-gtk = attrs: {
nativeBuildInputs = [ # nativeBuildInputs = [
pkgs.glib # pkgs.glib
]; # ];
}; # };
}; # };
}; # };
in { # in {
# gobject-sys = pkgs.buildRustCrate cargo.internal.crates.gobject-sys; # # gobject-sys = pkgs.buildRustCrate cargo.internal.crates.gobject-sys;
# kifu-gtk = (import ./kifu/kifu-gtk/Cargo.nix { # kifu-gtk = (import ./kifu/kifu-gtk/Cargo.nix {
# inherit pkgs; # inherit pkgs;
# buildRustCrateForPkgs = customBuildInfo; # buildRustCrateForPkgs = customBuildInfo;
# rootFeatures = [ "screenplay" ]; # rootFeatures = [ "screenplay" ];
# release = true; # release = true;
# }).rootCrate.build; # }).rootCrate.build;
cyberpunk-splash = (import ./cyberpunk-splash/Cargo.nix { # cyberpunk-splash = (import ./cyberpunk-splash/Cargo.nix {
inherit pkgs; # inherit pkgs;
buildRustCrateForPkgs = customBuildInfo; # buildRustCrateForPkgs = customBuildInfo;
release = true; # release = true;
}).rootCrate.build; # }).rootCrate.build;
#
dashboard = (import ./dashboard/Cargo.nix { # dashboard = (import ./dashboard/Cargo.nix {
inherit pkgs; # inherit pkgs;
release = true; # release = true;
}).rootCrate.build; # }).rootCrate.build;
}; # };
hydraJobs = {
inherit (self) packages;
};
}; };
} }

View File

@ -1,5 +1,5 @@
[package] [package]
name = "international-fixed-calendar" name = "ifc"
description = "chrono-compatible-ish date objects for the International Fixed Calendar" description = "chrono-compatible-ish date objects for the International Fixed Calendar"
version = "0.1.0" version = "0.1.0"
authors = ["Savanni D'Gerinel <savanni@luminescent-dreams.com>"] authors = ["Savanni D'Gerinel <savanni@luminescent-dreams.com>"]

View File

@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with Lum
extern crate chrono; extern crate chrono;
extern crate chrono_tz; extern crate chrono_tz;
extern crate international_fixed_calendar as IFC; extern crate ifc as IFC;
use chrono::{Datelike, Utc}; use chrono::{Datelike, Utc};

View File

@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with Lum
*/ */
use chrono::{Datelike, Utc}; use chrono::{Datelike, Utc};
use international_fixed_calendar as IFC; use ifc as IFC;
use iron::headers; use iron::headers;
use iron::middleware::Handler; use iron::middleware::Handler;
use iron::modifiers::Header; use iron::modifiers::Header;