Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/tiddlywiki: init #60436

Merged
merged 1 commit into from Jul 21, 2019
Merged

nixos/tiddlywiki: init #60436

merged 1 commit into from Jul 21, 2019

Conversation

nbardiuk
Copy link
Contributor

@nbardiuk nbardiuk commented Apr 29, 2019

Motivation for this change

Service that runs TiddlyWiki nodejs server.

Exposed options to

  • enable basic auth
  • path to existing wiki files
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@artemist
Copy link
Member

The tests succeed and look reasonable. I don't see any other problems with this (though I don't have merge authority).

@aanderse
Copy link
Member

aanderse commented May 1, 2019

@GrahamcOfBorg test tiddlywiki

@aanderse
Copy link
Member

aanderse commented May 1, 2019

Please add the test to all-tests.nix.

@nbardiuk
Copy link
Contributor Author

nbardiuk commented May 1, 2019

just added, sorry missed that earlier

@aanderse
Copy link
Member

aanderse commented May 2, 2019

I've never used tiddlywiki before so pardon the my silly question... but how do I save? When I click the save button my browser attempts to download an html file.

@nbardiuk
Copy link
Contributor Author

nbardiuk commented May 2, 2019

Good question! Short answers is that wiki is saved automatically and save button is just for emergency.

TiddlyWiki has started as wiki in a single file that contains all code and wiki pages. Users supposed to open their local html file work with it and then save using save button.

It is very inconvinient so different ways to automatically syncronize wiki emerged https://tiddlywiki.com/#GettingStarted

TiddlyWiki node server is one of them. It deconstructs single html file into folder of tiddlers and serves them as webapp. This approach is more convinient for web hosting.

The save button in a context of node server becomes an emergency backup option. It allows to quickly backup everything into single html file again.

@aanderse
Copy link
Member

aanderse commented May 2, 2019

When I cycled the server my work was gone. I'm not sure the auto save is properly working.

@nbardiuk
Copy link
Contributor Author

nbardiuk commented May 2, 2019

Good catch! I've made a mistake in the wiki initialization command. I've added test to make sure wiki is persisted between restarts properly

Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this fell off my radar. Sorry about that. Thanks for pinging me.

I ran this, created a file, saved, restarted the service and it was gone again. I'm probably doing something silly. Simple config:

  services.tiddlywiki.enable = true;
  services.tiddlywiki.listenOptions.port = 3000;

When I look under /var/lib/tiddlywiki/tiddlers I see the file I created, but it won't show up in the browser... Any suggestions?

nixos/modules/services/misc/tiddlywiki.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/tiddlywiki.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/tiddlywiki.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/tiddlywiki.nix Outdated Show resolved Hide resolved
nixos/tests/tiddlywiki.nix Outdated Show resolved Hide resolved
@nbardiuk
Copy link
Contributor Author

nbardiuk commented Jul 7, 2019

User interface is a bit confusing. New files are open only until page is reloaded.
You can use search to find any wiki file. Or try Recent tab under search bar, it should contain recently created files.

nixos/modules/services/misc/tiddlywiki.nix Outdated Show resolved Hide resolved
nixos/modules/services/misc/tiddlywiki.nix Outdated Show resolved Hide resolved
Service that runs TiddlyWiki nodejs server
@aanderse
Copy link
Member

So the trick about DynamicUser is that /var/lib/tiddlywiki actually maps to /var/lib/private/tiddlywiki. Your credentials file example may need some tweaking.

@nbardiuk
Copy link
Contributor Author

I understand your concern but I am not sure how to improve the example.

Credentials is relative path to dataDir https://tiddlywiki.com/#WebServer%20Parameter%3A%20credentials that is why in test on configured machine module can navigate from /var/lib/tiddlywiki to /var/lib/wikiusers.csv/ using ../wikiusers.csv credentials parameter.

The credentials parameter is not mandatory and admin can configure auth using either csv file or username/password https://tiddlywiki.com/#WebServer%20Parameter%3A%20username

@aanderse aanderse mentioned this pull request Jul 20, 2019
10 tasks
@aanderse
Copy link
Member

@GrahamcOfBorg test tiddlywiki

@aanderse aanderse merged commit 44565ad into NixOS:master Jul 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants