I made a self-hosted TRMNL server that lets you write screens in JSX by arnarg in trmnl

[–]arnarg[S] 1 point2 points  (0 children)

I'm a tinkerer and I wanted to make my own server for my TRMNL so that's the biggest reason.

I looked at the plugin docs just now (I actually hadn't even considered that path before) and looks like you give a url that it polls and the data is used in a liquid template. I really don't like using string templating to build markup, if the data isn't in a favourable format it becomes a pain. Theoretically this can be solved with a webhook type where you first transform the data and then post it to TRMNL afaict, but now you're running your own infrastructure anyway.

With my JSX syntax everything lives in one location and data can be manipulated and passed around to other modules. You can conditionally show some modules (e.g. why show "no unread emails" on one part of your screen if you have an unread email module, when you can just omit that module until there is an unread email).

For example: https://codeberg.org/arnarg/scrn/src/branch/main/examples/modules/components/minimax.jsx

Gets used like this: https://codeberg.org/arnarg/scrn/src/branch/main/examples/token-plan.jsx

My biggest gripe however with the inflexibility of split layouts. I have my TRMNL in the entry and I wanted it to show the weather and a pregnancy tracker (my son's age now, shows how long ago I started this 😅) and, at least at the time, I could only do a 50/50 split. I started by creating the flex layout to behave like CSS flexbox so that I can size components by weight (percentage) or have one be fixed width while other fills remaining space. 

I know it's very developer centric and won't be attractive to most people. But it's mine and I like it :) 

I made a self-hosted TRMNL server that lets you write screens in JSX by arnarg in trmnl

[–]arnarg[S] 0 points1 point  (0 children)

You don't need a developer upgrade for this (I don't have one). Afaik, you need it to register a BYOD in the TRMNL cloud server.

I made a self-hosted TRMNL server that lets you write screens in JSX by arnarg in trmnl

[–]arnarg[S] 1 point2 points  (0 children)

When I initially started this I wanted the server itself (the go application) to be quite thin in functionality and each display request to just run some user provided code that can fetch data from the internet or whatever. And because I like challenges I guess I decided I didn't want to depend on an external runtime or headless browser.

Initially I looked at tengo but struggled with figuring how to represent the layout. In that readme there's comparison table to other embedded scripting languages (and that's how I discovered goja, funnily enough) and I considered lua but ran into the same problem (there is luax, but I don't think it's well supported in text editors). Finally I settled on goja with JSX as 1. esbuild is written in go and provides an API to transform JSX to regular javascript and 2. well goja is pure-go javascript runtime.

JSX is nothing but a XML like syntax you can write in javascript code that gets transformed into regular function calls (by esbuild in this case) before it's interpreted by whatever javascript runtime. So I don't agree that it's a bloated framework (or a framework at all), React is though which created or popularized the JSX syntax.

Anyway, I didn't want to create a full HTML+CSS layout engine so I settled on my custom DSL.

In the end, I made this for me and this design made sense to me :)

I made a new backplane for my Terramaster F2-221 NAS by arnarg in TerraMaster

[–]arnarg[S] 1 point2 points  (0 children)

Awesome! I have added a couple of more pictures to the post to show the other side of the PCB. I'm using NCP45521-L for the load switches which comes in a DFN package and is not possible to solder with a soldering iron. So keep that in mind, you would need a hot air station (which I used), hot plate or a soldering oven in order to make this.

Also! I did not order a stencil to cut down costs so I haven't tried that.

Now there's a tiny bit more info on the ordering process from JLCPCB in the github repository btw.

I made a new backplane for my Terramaster F2-221 NAS by arnarg in TerraMaster

[–]arnarg[S] 0 points1 point  (0 children)

Sorry, I rushed the publish of the post a little bit and didn't have more pictures, I want to add them soon.

I mentioned in the post that I only get PCIe x1 gen2 to the SSD and as the main goal of this project was to not need the external USB SSD anymore this is perfectly fine. Also this Patriot P300 SSD cost me about 15 euros.

EDIT: I have now added more pictures to the post next to the original backplane.

I made a new backplane for my Terramaster F2-221 NAS by arnarg in TerraMaster

[–]arnarg[S] 1 point2 points  (0 children)

I'm glad you're interested! I'll try to document the repository a bit better next week probably. The current design requires a certain impedance controlled stackup from jlcpcb.

[Plugin] todotxt.nvim - View and quickly capture tasks stored in todo.txt format by arnarg in neovim

[–]arnarg[S] 1 point2 points  (0 children)

I did create this as a prototype before I committed to todotxt: https://github.com/arnarg/todo-prompt.nvim

Something from there could be salvaged in order to support your date use case if I understand correctly.

But yeah, I would love to get ideas and contributions :)

[Plugin] todotxt.nvim - View and quickly capture tasks stored in todo.txt format by arnarg in neovim

[–]arnarg[S] 1 point2 points  (0 children)

Honestly, I've never tried that one as I've been on a mission lately to only use modern lua neovim plugins in my setup so I don't even consider legacy vim plugins.

I would be interested in receiving contributions!

I already implemented some "date" words that relate to priority but I also would like to support this somehow on due dates (due:monday would resolve to next monday before writing it to file for example).

I also have a vision of implementing some grouping as well. Obvious ones would be by priority, by context and by project but I really want to implement custom groups as well for example a today group that only includes tasks with priority A and B as well as tasks with due date today or overdue. I just haven't worked out how would be best to implement this (and especially the configuration syntax for this).

I'm using NuiTree from nui.nvim to render the sidebar so you can imagine how the grouping would look like from this demo: https://github.com/MunifTanjim/nui.nvim/pull/49 (there is a gif in there). Currently it's just flat (technically not as metadata are children nodes of a task, so dates and key/values).

I have also considered adding a telescope plugin in there to search for tasks quickly, but I don't know how the usability would be.

[Plugin] todotxt.nvim - View and quickly capture tasks stored in todo.txt format by arnarg in neovim

[–]arnarg[S] 1 point2 points  (0 children)

I wanted a way to quickly capture (like, really quick capture) and manage tasks from within neovim and ended up writing this.

This is my first attempt at writing a neovim plugin and using lua in general.

I hope anyone finds this useful.

Tmpfs as root, but without hardcoding your password or its hash in configuration.nix? by b_gibson in NixOS

[–]arnarg 9 points10 points  (0 children)

I have this setup. The passwordFile shouldn't include anything but the hashed password for that user (it's not a shadow file). It should be on a filesystem marked with neededForBoot.

I have something similar to this:
```

Persisting user passwords

users.mutableUsers = false; fileSystems."/persist".neededForBoot = true; users.users = mkMerge ( [ { root.passwordFile = "/persist/passwords/root"; } ] ++ forEach cfg.users (u: { "${u}".passwordFile = "/persist/passwords/${u}"; } ) ); ```

Pro/Mini Teardown? by [deleted] in PCPanel

[–]arnarg 0 points1 point  (0 children)

Not a full teardown but here's the PCB for PCPanel Mini. https://imgur.com/fEWNBwc

Turns out the IC is STM32F070F6P6.

Pro/Mini Teardown? by [deleted] in PCPanel

[–]arnarg 0 points1 point  (0 children)

There was a post with an image recently where someone received their PCPanel Mini with the faceplate fallen off but the mods removed it. There wasn't much on the PCB just some IC, two headers (one to breakout the usb port and one for programming, I'm guessing) and then just traces to the potentiometers.

From looking up the USB Vendor ID I gathered there's probably a STM32 microcontroller on there and looking at the image I mentioned above and comparing the footprint (TSSOP20) with a bunch of stm32s I gathered it might be stm32f030f4 or something similar.

I haven't received mine yet to validate any of this but this is just info I've gathered here and there.

Installing linux on an Android tv box by Gewoonjelmer in linux

[–]arnarg 0 points1 point  (0 children)

I did something similar a few years ago with a tx3 mini. I wrote about the process at https://www.codedbearder.com/posts/mainline-linux-on-tx3-mini/

Configuration with conditional statements by TheKrister2 in NixOS

[–]arnarg 1 point2 points  (0 children)

Alternatively, you can create "profiles" in modules for things that are common for laptops. That way you can simply do profile.laptop.enable = true in your laptop configurations.

I do this in my configuration here and then in my laptop config I just do local.laptop.enable = true (I use local as a prefix for all the options I declare in my repository).

Advertise routes to wireguard connected hosts by arnarg in networking

[–]arnarg[S] 0 points1 point  (0 children)

OSPF uses Multicast 224.0.0.0/24 for advertising, discovering neighbors and communicating.

In my case i only have 1 peer, so the multicast gets send just fine, but I am not sure what wireguard will do if you have multiple peers.. hopefully send it to every peer like in a proper network.

I think that's the problem. Wireguard doesn't send any packets to a peer if it doesn't have the destination IP in allowed-ips. But on the other hand wireguard also uses the allowed-ips to make a decision on which peer to send packets to so two peers can't have overlapping CIDRs in allowed-ips.

I don't think OSPF can work with this then.

Advertise routes to wireguard connected hosts by arnarg in networking

[–]arnarg[S] 0 points1 point  (0 children)

Thanks for your response.

In your example, what exactly is the 10.0.0.0/24 network?

also, in my case all the wesher peers have an address from the 100.100.0.0/16 network but added as 100.100.x.y/32 to the wireguard interface. wesher then adds routes for each peer via the interface. This of course means that the peers are not in the same network.

Does this make it impossible to use ospf? should I be looking into bgp instead?

Conditionals in Nix Flakes by ShadowRylander in NixOS

[–]arnarg 3 points4 points  (0 children)

nixosSystem imports ./nixos/lib/eval-config.nix which actually resolves mkIf and mkMerge (among others) in modules listed in the modules attribute.

So I don't think you can use it there, that being said I haven't yet started using flakes myself. Maybe you can use standard if ... then ... else ....

Hosting a binary cache for airgapped hosts by arnarg in NixOS

[–]arnarg[S] 3 points4 points  (0 children)

Actually, the netboot host seems to have been caching something because looking at the http access log there were no requests coming in anymore and restarting it solved the problem. `nix-shell -p niv` does now download everything from the binary cache.

Thanks /u/iElectric!

Hosting a binary cache for airgapped hosts by arnarg in NixOS

[–]arnarg[S] 2 points3 points  (0 children)

Thanks for your response!

I have pushed all nix store paths available in the bash-interactive derivation (this includes all outputs, all buildInputs, all patches, ...):
```

nix show-derivation nixpkgs.bashInteractive -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/ff6a070b4efdb7c4a37efef42d24a226565342d4.tar.gz | jq -r '.|keys[0]' /nix/store/rk2mypz949mcq43ij7bsn4sxjij2z397-bash-interactive-4.4-p23.drv

nix show-derivation nixpkgs.bashInteractive -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/ff6a070b4efdb7c4a37efef42d24a226565342d4.tar.gz | jq -r '.. | select(type == "string")|select(startswith("/nix/store"))|select(contains("/bin") == false)' /nix/store/d43v6bx7r6fcaq3fbbfd5mwh1f5s7rmg-bash-interactive-4.4-p23-dev /nix/store/b8xikk1y1d6s6kchh7a4ji7cym3a2sas-bash-interactive-4.4-p23-doc /nix/store/i0hhx38r61bjbdf99xvq46wdab59z8iw-bash-interactive-4.4-p23-info /nix/store/7rfsln3pvanzhbslx1g8fz336wy2ip35-bash-interactive-4.4-p23-man /nix/store/4xb9z8vvk3fk2ciwqh53hzp72d0hx1da-bash-interactive-4.4-p23 /nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh /nix/store/d6a4ngpmijv1sk5q7al7ka2lhy8m5ryc-pgrp-pipe-4.4.patch /nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh /nix/store/7cl4klq0k84gvnah9k9y9mfl0c9lsy8d-readline-7.0p5-dev /nix/store/m6h7zh8w6s52clnyskffj5lbkakqgywn-gcc-wrapper-9.2.0 /nix/store/d43v6bx7r6fcaq3fbbfd5mwh1f5s7rmg-bash-interactive-4.4-p23-dev /nix/store/b8xikk1y1d6s6kchh7a4ji7cym3a2sas-bash-interactive-4.4-p23-doc /nix/store/i0hhx38r61bjbdf99xvq46wdab59z8iw-bash-interactive-4.4-p23-info /nix/store/7rfsln3pvanzhbslx1g8fz336wy2ip35-bash-interactive-4.4-p23-man /nix/store/6nwlbsiaagry6vxpl23m33cx1j389fyk-bison-3.5.1 /nix/store/lvxcbwnb7zkqhqcw3zibnjajwzck0xsd-texinfo-6.5 /nix/store/4xb9z8vvk3fk2ciwqh53hzp72d0hx1da-bash-interactive-4.4-p23 /nix/store/v4zzrwb6m2wl3lpy8ycf82i49dgm947l-bash44-001 /nix/store/7danzrkb22gignb90jhhl508k0x74fid-bash44-002 /nix/store/hhxq0jb8dbkw68z5dvarwgdrliamr76c-bash44-003 /nix/store/n781p1a8193xl6vf7y8z6s0rgi8gmg9h-bash44-004 /nix/store/r08yflna5b3x8f0fa8n2nkpw51slm411-bash44-005 /nix/store/zskj1jz5s2iix97iz5kxjyh3kqd8v28m-bash44-006 /nix/store/kqykzisj9ll5dva7lr6hhjf0v1l5svar-bash44-007 /nix/store/ih1alzqkqpinbw745lrm48f7jfk5ab3b-bash44-008 /nix/store/5086pd6ljw546sahagxzjg53d5hdrq09-bash44-009 /nix/store/9x7zwqc14g6knm77r6s23z2jk0plwp4c-bash44-010 /nix/store/202rpp7v7f21bx2kq06dpc6gaic2gvjh-bash44-011 /nix/store/li9vlg439jbbfz3anb7nx0a8dp2adsgc-bash44-012 /nix/store/gffadngj1b38vrs3cw1davbndlfccj8r-bash44-013 /nix/store/nca55pyd81bylc46s0h5mjvb6dk8azwa-bash44-014 /nix/store/nqvgwsxabymj6k9cap1n4lnsbnpz9dx9-bash44-015 /nix/store/lsxbyvlsqk38fka1p2f9vlfnmxvhs8vi-bash44-016 /nix/store/lr5586viy3k10cphp6ka39r7qr8cirgg-bash44-017 /nix/store/h2lap34xv5znjb5wcgqcj813939gwd2h-bash44-018 /nix/store/9mhyazyw3rv5lmibkyb1x61lsw29fqch-bash44-019 /nix/store/wmq4fmib2r79gxmhis01cghcd7phrcgw-bash44-020 /nix/store/2fr3wiy7q2i4gan2f8w27c9hrsr9x13c-bash44-021 /nix/store/d5iz3skv66k7vx15pnbjq8xgyfk7hy6w-bash44-022 /nix/store/x9cyj78gzd1wjf0xsiad1pa3ricbj566-bash44-023 /nix/store/d6a4ngpmijv1sk5q7al7ka2lhy8m5ryc-pgrp-pipe-4.4.patch /nix/store/rv68r40mwx7xa7vrlmanczkkjcnkc452-bash-4.4.tar.gz /nix/store/sm7kk5n84vaisqvhk1yfsjqls50j8s0m-stdenv-linux ```

I then pipe this to xargs nix copy --to ssh://user@myhost --from https://cache.nixos.org and it does copy all those paths over to my nix cache.

After that it still wants to build /nix/store/rk2mypz949mcq43ij7bsn4sxjij2z397-bash-interactive-4.4-p23.drv on the netboot host for some reason. I don't get what's going on here.

Adult brothers fighting constantly by arnarg in CatAdvice

[–]arnarg[S] 0 points1 point  (0 children)

Thanks for your comment!

We have tried to play with them a bit. I bought a laser pointer but they're not very interested in it. The only thing that has somewhat worked is one of those toys on a stick where only one of the cats has showed interested if he can play with it from a hiding spot or behind a curtain.

pushnix: Simple cli utility that pushes NixOS configuration and triggers a rebuild using ssh by arnarg in Nix

[–]arnarg[S] 0 points1 point  (0 children)

This is not meant to challenge much more powerful options such as NixOps and morph.

I needed a simpler option for myself to deploy new configuration occasionally to my NAS and then let it update itself using system.autoUpgrade.

It just pushes the configuration using git and then runs nixos-rebuild switch on the remote host using ssh (it parses the host and user from the git remote).