ft/adds flake.nix

TODO: add 'rustup target add wasm32-unknown-unknown' to flake
This commit is contained in:
itsscb 2024-05-19 21:36:12 +00:00
parent 566a95b5d7
commit 38dab9775b
13 changed files with 2487 additions and 33 deletions

View File

@ -1,7 +1,7 @@
[[hooks]] [[hooks]]
stage = "build" stage = "build"
command = "npx" command = "tailwindcss"
command_arguments = ["tailwindcss", "-i","input.css","-o","public/styles.css"] command_arguments = ["-i","input.css","-o","public/styles.css"]
[serve] [serve]
address = "0.0.0.0" address = "0.0.0.0"

File diff suppressed because one or more lines are too long

Binary file not shown.

150
dist/index.html vendored
View File

@ -1 +1,149 @@
<!doctype html><html lang=en><meta charset=UTF-8><meta content="width=device-width,initial-scale=1" name=viewport><title>Digitaler Frieden</title><link href=/styles-5591055ecd987932.css integrity=sha384-a1WEqxtAH6YUfKJ4yrHqkgiTWmHSE42XmyBtxbyCY/WaCq4Is/iVWx0Q1jgF3cVf rel=stylesheet><link href=/favicon-928ba63f33046eed.ico integrity=sha384-Neq57jnFrTfqAN1JvKAVVVcH1EW3//cZHmK2NRXRlNrxAZR6ErTvXzbOLSyHzkA4 rel=icon><link href=public/manifest.json rel=manifest><link as=fetch crossorigin href=/digitaler-frieden-eab7a54548d51de2_bg.wasm integrity=sha384-yIgdjjA54X2bCfznoV2thson0zMX/fylXo3m3P6SQUskENlvhwzInFeXgmspjxws rel=preload type=application/wasm><link crossorigin href=/digitaler-frieden-eab7a54548d51de2.js integrity=sha384-Cv8tsSgrMidET9utI0GS5mGbbYqFPiVDuqpIdmg3Xx2gn3M6iEcvr2b5TuuW93cS rel=modulepreload></head><body class="bg-black text-white"><script type=module>import a,*as b from"/digitaler-frieden-eab7a54548d51de2.js";a(`/digitaler-frieden-eab7a54548d51de2_bg.wasm`);window.wasmBindings=b</script></body></html> <!DOCTYPE html><html lang="en"><head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Digitaler Frieden</title>
<link rel="stylesheet" href="/styles-1c1ffa0ed4dcf17b.css" integrity="sha384-Kc38bWxDbfvH9ik8vn0X2gI2Ly3klTYa8LCwMHYSjDO3MT1eBfZ2gOGZEo82Ma2A">
<link rel="icon" href="/favicon-928ba63f33046eed.ico" integrity="sha384-Neq57jnFrTfqAN1JvKAVVVcH1EW3__cZHmK2NRXRlNrxAZR6ErTvXzbOLSyHzkA4">
<link rel="manifest" href="public/manifest.json">
<link rel="preload" href="/digitaler-frieden-b21c8f401a19ebc01d7358c9e46d7d6b99469b679616e7121d45743b288bd70fc64efefd5b66105519c43ee7db06228f_bg.wasm" as="fetch" type="application/wasm" crossorigin="anonymous" integrity="sha384-shyPQBoZ68Adc1jJ5G19a5lGm2eWFucSHUV0OyiL1w_GTv79W2YQVRnEPufbBiKP">
<link rel="modulepreload" href="/digitaler-frieden-b21c8f401a19ebc01d7358c9e46d7d6b99469b679616e7121d45743b288bd70fc64efefd5b66105519c43ee7db06228f.js" crossorigin="anonymous" integrity="sha384-DJ_YOtf-jyiqjDdwgVPQmwviJ4qIYrDO4VXbVIoPcVmGcLWAmuE8h5FcWb0XOCIp"></head>
<body class="bg-black text-white">
<script type="module">
import init, * as bindings from '/digitaler-frieden-b21c8f401a19ebc01d7358c9e46d7d6b99469b679616e7121d45743b288bd70fc64efefd5b66105519c43ee7db06228f.js';
init('/digitaler-frieden-b21c8f401a19ebc01d7358c9e46d7d6b99469b679616e7121d45743b288bd70fc64efefd5b66105519c43ee7db06228f_bg.wasm');
window.wasmBindings = bindings;
</script><script>"use strict";
(function () {
const address = '{{__TRUNK_ADDRESS__}}';
let protocol = '';
protocol =
protocol
? protocol
: window.location.protocol === 'https:'
? 'wss'
: 'ws';
const url = protocol + '://' + address + '/_trunk/ws';
class Overlay {
constructor() {
// create an overlay
this._overlay = document.createElement("div");
const style = this._overlay.style;
style.height = "100vh";
style.width = "100vw";
style.position = "fixed";
style.top = "0";
style.left = "0";
style.backgroundColor = "rgba(222, 222, 222, 0.5)";
style.fontFamily = "sans-serif";
// not sure that's the right approach
style.zIndex = "1000000";
style.backdropFilter = "blur(1rem)";
const container = document.createElement("div");
// center it
container.style.position = "absolute";
container.style.top = "30%";
container.style.left = "15%";
container.style.maxWidth = "85%";
this._title = document.createElement("div");
this._title.innerText = "Build failure";
this._title.style.paddingBottom = "2rem";
this._title.style.fontSize = "2.5rem";
this._message = document.createElement("div");
this._message.style.whiteSpace = "pre-wrap";
const icon= document.createElement("div");
icon.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" fill="#dc3545" viewBox="0 0 16 16"><path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/></svg>';
this._title.prepend(icon);
container.append(this._title, this._message);
this._overlay.append(container);
this._inject();
window.setInterval(() => {
this._inject();
}, 250);
}
set reason(reason) {
this._message.textContent = reason;
}
_inject() {
if (!this._overlay.isConnected) {
// prepend it
document.body?.prepend(this._overlay);
}
}
}
class Client {
constructor(url) {
this.url = url;
this.poll_interval = 5000;
this._overlay = null;
}
start() {
const ws = new WebSocket(this.url);
ws.onmessage = (ev) => {
const msg = JSON.parse(ev.data);
switch (msg.type) {
case "reload":
this.reload();
break;
case "buildFailure":
this.buildFailure(msg.data)
break;
}
};
ws.onclose = this.onclose;
}
onclose() {
window.setTimeout(
() => {
// when we successfully reconnect, we'll force a
// reload (since we presumably lost connection to
// trunk due to it being killed, so it will have
// rebuilt on restart)
const ws = new WebSocket(this.url);
ws.onopen = () => window.location.reload();
ws.onclose = this.onclose;
},
this.poll_interval);
}
reload() {
window.location.reload();
}
buildFailure({reason}) {
// also log the console
console.error("Build failed:", reason);
console.debug("Overlay", this._overlay);
if (!this._overlay) {
this._overlay = new Overlay();
}
this._overlay.reason = reason;
}
}
new Client(url).start();
})()
</script></body></html>

View File

@ -1,5 +1,5 @@
/* /*
! tailwindcss v3.4.3 | MIT License | https://tailwindcss.com ! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com
*/ */
/* /*
@ -211,8 +211,6 @@ textarea {
/* 1 */ /* 1 */
line-height: inherit; line-height: inherit;
/* 1 */ /* 1 */
letter-spacing: inherit;
/* 1 */
color: inherit; color: inherit;
/* 1 */ /* 1 */
margin: 0; margin: 0;
@ -236,9 +234,9 @@ select {
*/ */
button, button,
input:where([type='button']), [type='button'],
input:where([type='reset']), [type='reset'],
input:where([type='submit']) { [type='submit'] {
-webkit-appearance: button; -webkit-appearance: button;
/* 1 */ /* 1 */
background-color: transparent; background-color: transparent;
@ -494,10 +492,6 @@ video {
--tw-backdrop-opacity: ; --tw-backdrop-opacity: ;
--tw-backdrop-saturate: ; --tw-backdrop-saturate: ;
--tw-backdrop-sepia: ; --tw-backdrop-sepia: ;
--tw-contain-size: ;
--tw-contain-layout: ;
--tw-contain-paint: ;
--tw-contain-style: ;
} }
::backdrop { ::backdrop {
@ -548,10 +542,6 @@ video {
--tw-backdrop-opacity: ; --tw-backdrop-opacity: ;
--tw-backdrop-saturate: ; --tw-backdrop-saturate: ;
--tw-backdrop-sepia: ; --tw-backdrop-sepia: ;
--tw-contain-size: ;
--tw-contain-layout: ;
--tw-contain-paint: ;
--tw-contain-style: ;
} }
.visible { .visible {

1177
dist/styles-1c1ffa0ed4dcf17b.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

83
flake.lock generated Normal file
View File

@ -0,0 +1,83 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1706487304,
"narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "90f456026d284c22b3e3497be980b2e47d0b28ac",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": [
"rust-overlay",
"nixpkgs"
],
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1716085073,
"narHash": "sha256-3+9gI93XxszWA2+9S2xZfws1QArPX/MC6nahOGpcMB4=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "cfc8776011bd83508324115d353222475e1601c0",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

65
flake.nix Normal file
View File

@ -0,0 +1,65 @@
{
description = "Example Rust development environment for Zero to Nix";
# Flake inputs
inputs = {
# nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
rust-overlay.url = "github:oxalica/rust-overlay"; # A helper for Rust + Nix
# cargo2nix.url = "github:cargo2nix/cargo2nix/";
nixpkgs.follows = "rust-overlay/nixpkgs";
};
# Flake outputs
outputs = { self, nixpkgs, rust-overlay}:
let
# Overlays enable you to customize the Nixpkgs attribute set
overlays = [
# Makes a `rust-bin` attribute available in Nixpkgs
(import rust-overlay)
# Provides a `rustToolchain` attribute for Nixpkgs that we can use to
# create a Rust environment
(self: super: {
rustToolchain = super.rust-bin.stable.latest.default;
})
];
# Systems supported
allSystems = [
"x86_64-linux" # 64-bit Intel/AMD Linux
"aarch64-linux" # 64-bit ARM Linux
"x86_64-darwin" # 64-bit Intel macOS
"aarch64-darwin" # 64-bit ARM macOS
];
# rustTarget = nixpkgs.pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
# extensions = [ "rust-src" "rustup" "rust-analyzer" "rust-std" ];
# targets = [ "x86_64-unknown-linux-gnu" "wasm32-unknown-unknown" ];
# });
# Helper to provide system-specific attributes
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
in
{
# Development environment output
devShells = forAllSystems ({ pkgs }: {
default = pkgs.mkShell {
# buildInputs = [
# rustup
# ];
# shellHook = ''
# rustup target add wasm32-unknown-unknown
# '';
# The Nix packages provided in the environment
packages = (with pkgs; [
# The package provided by our custom overlay. Includes cargo, Clippy, cargo-fmt,
# rustdoc, rustfmt, and other tools.
trunk
tailwindcss
rustToolchain
]) ++ pkgs.lib.optionals pkgs.stdenv.isDarwin (with pkgs; [ libiconv ]);
};
});
};
}

View File

@ -1,5 +1,5 @@
/* /*
! tailwindcss v3.4.3 | MIT License | https://tailwindcss.com ! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com
*/ */
/* /*
@ -211,8 +211,6 @@ textarea {
/* 1 */ /* 1 */
line-height: inherit; line-height: inherit;
/* 1 */ /* 1 */
letter-spacing: inherit;
/* 1 */
color: inherit; color: inherit;
/* 1 */ /* 1 */
margin: 0; margin: 0;
@ -236,9 +234,9 @@ select {
*/ */
button, button,
input:where([type='button']), [type='button'],
input:where([type='reset']), [type='reset'],
input:where([type='submit']) { [type='submit'] {
-webkit-appearance: button; -webkit-appearance: button;
/* 1 */ /* 1 */
background-color: transparent; background-color: transparent;
@ -494,10 +492,6 @@ video {
--tw-backdrop-opacity: ; --tw-backdrop-opacity: ;
--tw-backdrop-saturate: ; --tw-backdrop-saturate: ;
--tw-backdrop-sepia: ; --tw-backdrop-sepia: ;
--tw-contain-size: ;
--tw-contain-layout: ;
--tw-contain-paint: ;
--tw-contain-style: ;
} }
::backdrop { ::backdrop {
@ -548,10 +542,6 @@ video {
--tw-backdrop-opacity: ; --tw-backdrop-opacity: ;
--tw-backdrop-saturate: ; --tw-backdrop-saturate: ;
--tw-backdrop-sepia: ; --tw-backdrop-sepia: ;
--tw-contain-size: ;
--tw-contain-layout: ;
--tw-contain-paint: ;
--tw-contain-style: ;
} }
.visible { .visible {

View File

@ -5,6 +5,7 @@ use crate::router::Route;
#[function_component] #[function_component]
pub fn Clues() -> Html { pub fn Clues() -> Html {
let mail: Vec<String> = vec![];
html! { html! {
<div class="flex flex-col justify-center items-center h-full space-y-16 px-8 m-0"> <div class="flex flex-col justify-center items-center h-full space-y-16 px-8 m-0">
<section id="navigation" class="mb-12"> <section id="navigation" class="mb-12">
@ -66,6 +67,7 @@ pub fn Clues() -> Html {
> >
<div class="flex justify-between w-full relative"> <div class="flex justify-between w-full relative">
<h3 class="font-bold text-2xl ">{ "E-Mail Adressen" }</h3> <h3 class="font-bold text-2xl ">{ "E-Mail Adressen" }</h3>
<button>
<svg <svg
class="text-primary w-10 absolute right-4" class="text-primary w-10 absolute right-4"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@ -77,6 +79,7 @@ pub fn Clues() -> Html {
d="M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4V7zm-1-5C6.49 2 2 6.49 2 12s4.49 10 10 10 10-4.49 10-10S17.51 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z" d="M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4V7zm-1-5C6.49 2 2 6.49 2 12s4.49 10 10 10 10-4.49 10-10S17.51 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"
/> />
</svg> </svg>
</button>
</div> </div>
<div class="flex justify-start items-center space-x-4 w-full"> <div class="flex justify-start items-center space-x-4 w-full">
<svg <svg