NixOS configuration File for TW5

Has anyone created a TiddlyWiki5 NixOS configuration?

I just heard about NixOS in the last week and the single file nature of the OS made me think of TW.

Thanks in advance.

1 Like

I just reviewed this at a high level, and it seems more like a meta subject, perhaps you could explain how and why this may work with tiddlywiki so others can give some feedback?

What makes you think, that NixOS is a single file?

I think he is referring to the fact that NixOS packages are installed separately and isolated from other packages, little virtual environments, so I guess, in a way, you could think of each app as a single file kind of thing. So if you wanted the nodejs tiddlywiki installed, you could just use the “nix-shell -p nodePackages.tiddlywiki” to install the currently supported package for v5.2.7, but for 5.3.0 which there currently is no prebuilt nix package for, you could do “nix-shell -p nodejs npm” command and then run “npm install -g tiddlywiki” in the isolated shell I guess.

So I assume, RichShumaker, you just wants to know if anyone has tried out Tiddlywiki on NixOS I guess?

Well, you can give it a whirl and let us know, I am sure it would work just fine, but not sure how it would work on a reboot of the system. Not familiar enough with NixOS on startup and if you can auto launch a nodejs shell and run tiddlywiki in the background while doing other stuff or not.

But you really wouldn’t need the whole NixOS, you could just install the Nix package manager on your existing sytem. I mean any system that can run nodejs can run tiddlywiki, so not sure if you think there would be issues with it or something :man_shrugging:

I did not see anything about it yet. Did search - found: nixos/tiddlywiki: init by nbardiuk · Pull Request #60436 · NixOS/nixpkgs · GitHub but not really sure what it does yet.

1 Like

A NixOS package would likely mean TW in NodeJS mode with an nginx config so that it is served up safely.

There is limited packaging like this in the community so no NixOS that I know of.

A quick search shows this Dockerized version that could be used for inspiration

I suggest containerizing the specific TW5 tooling you have in mind. Technically, the specifications of the container can be written into your configuration.nix file, if you wish. To my eyes, NixOS enables you to build a good base system for running other systems. Junest and Distrobox on top of NixOS are pretty dope, btw.

NixOS Configuration file is a single File.

That file can easily be shared and then built on another system.

So a TW5 Installation with everything needed could easily be shared as a TW5 file could be.

2 Files and you have an OS and your data set.

It seems NixOS has a preconfigured tiddlywiki.service in their default configurations. It was created in 2019 … But there are no examples, how to use that stuff.

The good thing is, that this service uses the credentials.csv file by default, which gives a little bit of security, if users ever want to create internet facing configuration.

There is a gh-issue, which discusses a TW configuration in a slightly different context. … but I did invite the user of the OP to our forum. Let’s see what happens.

1 Like

OK. If you see it form the config-file perspective, it probably could be a single file.

What I would be interested in, is the reproducibility of a working system with different computers. If the configuration would be minimally secure by default. I would be happy.

1 Like

This is why I was asking as NixOS. It is an old Linux distro and uses it’s own everything I think TW is older but TW5 may not be.

The overall idea is that everything you can configure on Linux is in one configuration file. This allows you to change things in the configuration file and the system updates accordingly. You can also change things via the “normal methods” as well. And the system then changes the configuration for you.

It is very Command Line oriented for power users but could be used as a normal Linux distro via GUI and GUI changes to the system.

I know about the Docker stuff even if I have not used it much. This is totally different to me. It is building a TW5 OS from scratch for a targeted usage. Then people could change what they needed at the OS level through simple changes in a text editor.

It may be completely useless in the real world except I had not heard anyone ever talking about NixOS that is why I asked. Also the single file aspect intrigued me as that was and is a strength of TW.

Here is an AI generated description of this Single File Configuration I am discussing.

The NixOS configuration file is a single .nix file that allows you to configure the entire system state, including which packages to install and all the system settings and options. The configuration file is normally located at /etc/nixos/configuration.
The NixOS configuration file also allows you to configure the building process itself. You can edit the settings of other applications that are installed in your system packages.
To install a package using the Nix config file, you have to enter the package’s name in the config file, rebuild, and switch to the config file.

EDIT
This allows for easy versioning of the OS as well.

Hey! I am that person @pmario mentioned. Nice to get invited to here.

To clarify some things about NixOS: it really is two things, nixpkgs, which is a sort of package repository for the nix package manager, as well as the NixOS module system which builds an entire OS on the same theoretical foundation.

There is a tiddlywiki package in nixpkgs which just gives you its executable if you install it, similar to npm or whatever. You could use that just like any other TW5 installation, even on other operating systems than NixOS.

Then there is the tiddlywiki nixos service module. This enables you to configure a complete instance of a tiddlywiki nodejs server declaratively in your nixos configuration. This module system basically takes your nix configuration and in this case builds a systemd service that runs tiddlywiki with the chosen configuration. If you change your configuration you can apply those changes and nixos will figure out by itself e.g. which services have to be restarted and stuff like that.

BTW, this nixos configuration does not have to be a single file. It is written in the nix programming language, which also can import other nix files. That way you can modularize your system configuration for better readability and reuse parts in different systems. For example, I have a .nix file configuring the ssh public key allowed to access root on my systems, and that is reused across all my systems so I just have to configure that once.

You can find my tiddlywiki configuration in hosts/nelvte/mpanra/tiddlywiki.nix · 58b9f3f4ff72ccc750e26fe8820ebe805f4d6336 · Matthias Riße / nixfiles · GitLab (as well as the entire config of my nixos systems in that repository). Feel free to ask if you have any questions about it.

1 Like

Welcome here at Talk Tiddlywiki

Thank you for your reply. We’ll have a closer look and will probably have more question.

kind regards
Mario

T H A N K S ! ! !

That helps explain it extremely well and I like the fact that what I was looking for is already there, meaning NixOS has TW5 “availability”. Just add some things to your NixOS configuration and TW5 will be added “easily”. I am also aware there are different deployments of TW5 from a single HTML file to a Node.js server version and possible combination or variations on that.

I liked the description of changing the configuration and NixOS figures out the dependencies depending on the configuration you choose. Also you could change it later and the OS would make the required changes.

In regards to the multiple files that makes a lot of sense too. I was under the impression it was always one so that helps me understand it better So a TW5 Node.js configuration could be “created” and the main NixOS could simply have an “add that to this”?(I made it a question to say, did I understand what you said correctly?)
Do you know if anyone is maintaining a TW5 NixOS “add in” on GitHub or elsewhere?(d’oh!!! Seems like the link is exactly what I just asked about)

I will be checking out the link you sent and I really appreciate the help.