testing stuff

This commit is contained in:
Rakarake 2026-03-07 19:21:18 +01:00
parent d1b04c13d1
commit e0c772db92
6 changed files with 199 additions and 8 deletions

71
flake.lock generated
View file

@ -1,5 +1,21 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
@ -50,11 +66,28 @@
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1771043024,
"narHash": "sha256-O1XDr7EWbRp+kHrNNgLWgIrB0/US5wvw9K6RERWAj6I=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3aadb7ca9eac2891d52a9dec199d9580a6e2bf44",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
"rust-overlay": "rust-overlay",
"zig-overlay": "zig-overlay"
}
},
"rust-overlay": {
@ -89,6 +122,42 @@
"repo": "default",
"type": "github"
}
},
"systems_2": {
"flake": false,
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"zig-overlay": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs_3",
"systems": "systems_2"
},
"locked": {
"lastModified": 1772540502,
"narHash": "sha256-HXlx2i9gGH2HKfBSMihKCvU6DQMVlR4iyOulkSOe+Cg=",
"owner": "mitchellh",
"repo": "zig-overlay",
"rev": "03fa375def0685b8ce282f118452532845f16a20",
"type": "github"
},
"original": {
"owner": "mitchellh",
"repo": "zig-overlay",
"type": "github"
}
}
},
"root": "root",

View file

@ -5,9 +5,10 @@
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # or whatever vers
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
zig-overlay.url = "github:mitchellh/zig-overlay";
};
outputs = { self, nixpkgs, flake-utils, rust-overlay, ... }:
outputs = { self, nixpkgs, flake-utils, rust-overlay, zig-overlay, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
@ -19,8 +20,11 @@
devShell = pkgs.mkShell rec {
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}";
packages = with pkgs; [
(rust-bin.selectLatestNightlyWith (toolchain: toolchain.default))
rustc
cargo
rust-analyzer
gcc
zig-overlay.packages."x86_64-linux".master
];
buildInputs = with pkgs; [
libdisplay-info

40
main.zig Normal file
View file

@ -0,0 +1,40 @@
const std = @import("std");
pub fn main(init: std.process.Init) !void {
const xdxdx = try std.Io.Dir.readFileAlloc(std.Io.Dir.cwd(), init.io, "main.zig", init.gpa, .unlimited);
defer init.gpa.free(xdxdx);
std.debug.print("morbius {s} {s}\n", .{xdxdx, "morbius"});
switch (f(.blub)) {
.hop => {},
.jobb => {},
}
const heee = h();
std.debug.print("{any}\n", .{heee});
var huhhh: std.ArrayList(u18) = .empty;
defer huhhh.deinit(init.gpa);
try huhhh.append(init.gpa, 3333);
const Vec3 = @Vector(3, u4);
const a: Vec3 = .{3, 4, 5};
//const b: Vec3 = .{3, 4, 5};
std.debug.print("{any}", .{@reduce(.Add, a)});
//inline for (.{Gloob {}, Gleeeb {}}) |v| {
// v.morbiusss();
//}
}
//const Gloob = struct {
// fn morbiusss( self: @This ) void {
// }
//};
const Gleeeb = struct {
fn morbiusss() void {
}
};
fn h() [4]u8 {
return .{3,4,2,1};
}
fn f(x: enum { glob, blub }) enum { hop, jobb } {
_ = x;
return .jobb;
}

5
run.sh
View file

@ -1,3 +1,6 @@
#/bin/sh
cargo run "$@" > blog.html
sed template.html -e '/INSERT_HERE/r blog.html' > result.html
sed template.html -e '/INSERT_HERE/{
r blog.html
d
}' > result.html

View file

@ -1,12 +1,80 @@
use std::fs::read;
fn header(i: &str) -> Option<(&str, String)> {
let mut itr = i.chars();
if let Some(next) = itr.next() && next == '\n' {
if let Some(maybe_star) = itr.skip_while(|c| *c == ' ' || *c == '\t').next() && maybe_star == '*' {
}
}
Some((i, "<h1>".to_string()))
}
fn main() {
// arg 1: src, arg 2: dest
let args: Vec<String> = std::env::args().collect();
let input: String = std::fs::read_to_string(&args[1]).unwrap();
let mut output = input;
let mut output: String = String::new();
let mut is_bold = false;
let mut title: Option<usize> = None;
let mut itr = input.chars().peekable();
while let Some(c) = itr.next() {
match c {
'*' => {
if !is_bold {
output.push_str("<b>");
is_bold = true;
} else {
output.push_str("</b>");
is_bold = false;
}
}
'\n' => {
if let Some(title_count) = title {
title = None;
output.push_str(&format!("</h{title_count}>"));
} else {
let mut title_count = 0;
while let Some(c) = itr.peek() {
if *c == '#' {
title_count += 1;
} else if *c == ' ' || *c == '\t' {
// it is title
output.push_str(&format!("<h{title_count}>"));
title = Some(title_count);
} else {
}
}
}
output.push('\n');
}
_ => {
output.push(c);
}
}
}
println!("{output}");
//let output: String = input.lines().map(|l| {
// // Titles
// let count = l.chars().take_while(|c| *c == '#').count();
// if count > 0 {
// format!("<h{count}>{}</h{count}>", &l[count..])
// } else {
// l.to_string()
// }
//})
//.map(|l| {
// if l.chars().skip_while(|c| *c == ' ' || *c == '\t').next().unwrap_or('g') == '*' {
//
// } else {
// l.to_string()
// }
//})
//.collect();
// headings: replace # - newline to <h1> - </h1>
println!("{}", output);
//println!("{}", output);
}

View file

@ -7,6 +7,13 @@
<body>
<p>MDF BLOG 🍼</p>
INSERT_HERE
<h2>Testing erm, stuff</h2>
<b>bold</b>
<ul>
<li>an item</li>
</ul>
<i>italics</i>
🔈️🍰👆️
</body>
</html>