Initial commit
This commit is contained in:
commit
9a5b3e282a
17 changed files with 490 additions and 0 deletions
31
src/config.toml
Normal file
31
src/config.toml
Normal file
|
@ -0,0 +1,31 @@
|
|||
# The URL the site will be built for
|
||||
base_url = "https://www.chvp.be"
|
||||
|
||||
title = "Charlotte Van Petegem's website"
|
||||
description = "Blog posts and other musings"
|
||||
|
||||
# Whether to automatically compile all Sass files in the sass directory
|
||||
compile_sass = true
|
||||
|
||||
# Whether to build a search index to be used later on by a JavaScript library
|
||||
build_search_index = false
|
||||
|
||||
generate_feed = false
|
||||
|
||||
taxonomies = [
|
||||
{ name = "Tags" }
|
||||
]
|
||||
|
||||
[markdown]
|
||||
# Whether to do syntax highlighting
|
||||
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
|
||||
highlight_code = true
|
||||
highligt_theme = "ayu-dark"
|
||||
external_links_target_blank = true
|
||||
external_links_no_follow = true
|
||||
external_links_no_referrer = true
|
||||
smart_punctuation = true
|
||||
|
||||
|
||||
[extra]
|
||||
# Put all your custom variables here
|
3
src/content/_index.md
Normal file
3
src/content/_index.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
+++
|
||||
title = "Homepage"
|
||||
+++
|
10
src/content/about.md
Normal file
10
src/content/about.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
+++
|
||||
title = "About me"
|
||||
+++
|
||||
|
||||
I am a PhD student at Ghent University working on
|
||||
[Dodona](https://dodona.ugent.be/en). My main side project is
|
||||
[Accentor](https://github.com/accentor), a self-hosted music server. I am
|
||||
passionate about NixOS and general open-source development. My hobbies also
|
||||
include listening to music, going to concerts, reading, and long-distance
|
||||
running. In the remaining time I volunteer for the Red Cross.
|
131
src/content/blog/2022-11-03-unifiedpush-nextcloud-nixos.md
Normal file
131
src/content/blog/2022-11-03-unifiedpush-nextcloud-nixos.md
Normal file
|
@ -0,0 +1,131 @@
|
|||
+++
|
||||
title = "Setting up Nextcloud as a UnifiedPush provider on NixOS"
|
||||
[taxonomies]
|
||||
Tags = ["Nix", "NixOS", "Fediverse", "Matrix", "Android"]
|
||||
+++
|
||||
|
||||
I recently set up Nextcloud as a UnifiedPush provider on NixOS. Since others
|
||||
might want to do the same, I've detailed the process in this blog post. First I
|
||||
will explain in a nutshell what UnifiedPush is and why anyone would want to use
|
||||
it, next I will go over the steps required for setting it up.
|
||||
|
||||
<!-- more -->
|
||||
## UnifiedPush
|
||||
|
||||
UnifiedPush is used to deliver push notifications to Android devices. It
|
||||
specifies how servers should talk with push providers, and how apps should talk
|
||||
with push distributors. The push distributor is the only app keeping open a
|
||||
connection to the push provider, making this a lot more efficient than every app
|
||||
that needs push notifications implementing its own polling mechanism. Since
|
||||
receiving push notifications is the only function of a push distributor, I also
|
||||
trust it more to do so efficiently. When the push distributor receives a
|
||||
notification, it distributes it to the corresponding app, which can now react to
|
||||
the actual notification.
|
||||
|
||||
Apps that want to receive push notifications need to register with the push
|
||||
distributor first. The push distributor will then give the app the information
|
||||
that the server backend needs to send the push notifications.
|
||||
|
||||
Note that nothing about this is Android-specific; one could implement a push
|
||||
distributor for any sufficiently open platform (in fact, a [D-Bus distributor
|
||||
specification](https://unifiedpush.org/spec/dbus/) exists). However, since
|
||||
Android is the most widely-used mobile OS where something like this is possible,
|
||||
it is the platform where most of the development has happened.
|
||||
|
||||
UnifiedPush is a great alternative to Firebase Cloud Messaging (Google's push
|
||||
notification service). Apps do not need to register with any central authority
|
||||
and do not need to pay to send push notifications. Users are free to choose
|
||||
which service their data flows through, and as this post shows, can even
|
||||
self-host this service. A number of apps already support this service; in my
|
||||
case I am using [Tusky](https://tusky.app/) (a Mastodon client) and [Element
|
||||
Android](https://matrix.org/docs/projects/client/element-android/) (a Matrix
|
||||
client).
|
||||
|
||||
## Configuring Nextcloud
|
||||
|
||||
### Prerequisites
|
||||
|
||||
I assume that you've already set up a Nextcloud instance (using the [NixOS module](https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=services.nextcloud.)). The
|
||||
module is not that complicated if not. Feel free to steal any part of [my config](https://github.com/chvp/nixos-config/blob/main/modules/services/nextcloud/default.nix).
|
||||
|
||||
### NixOS configuration
|
||||
|
||||
First, you need to make sure that Nextcloud can load the redis PHP module, that
|
||||
you have a redis server running and that Nextcloud is configured to use it. Redis
|
||||
is used as a message broker in this case, so if this part is missing the
|
||||
communication from the notifying servers will not go through to the devices that
|
||||
are listening. In addition to redis, you also need to tweak nginx to allow the
|
||||
long-running requests that are typically used for push notifications.
|
||||
|
||||
The configuration for Nextcloud should look like this:
|
||||
|
||||
```nix
|
||||
{
|
||||
services.nextcloud = {
|
||||
# Your other configuration here
|
||||
caching.redis = true;
|
||||
extraOptions.redis = {
|
||||
host = "127.0.0.1";
|
||||
port = 31638;
|
||||
dbindex = 0;
|
||||
timeout = 1.5;
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Of course, you need to configure redis as well:
|
||||
|
||||
```nix
|
||||
{
|
||||
services.redis.servers.nextcloud = {
|
||||
enable = true;
|
||||
port = 31638;
|
||||
bind = "127.0.0.1";
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
And finally, you need to make sure you allow long-running requests in nginx:
|
||||
|
||||
```nix
|
||||
{
|
||||
services.nginx.virtualHosts."your.nextcloud.hostname".extraConfig = ''
|
||||
fastcgi_connect_timeout 10m;
|
||||
fastcgi_read_timeout 10m;
|
||||
fastcgi_send_timeout 10m;
|
||||
'';
|
||||
}
|
||||
```
|
||||
|
||||
Make sure to switch to the new configuration after making your edits.
|
||||
|
||||
### Nextcloud configuration
|
||||
|
||||
After setting up Nextcloud itself, you still need to install the ["UnifiedPush
|
||||
Provider"](https://apps.nextcloud.com/apps/uppush) app. This can be found under
|
||||
the Multimedia category in the Nextcloud apps admin interface. Note that you can
|
||||
also manage Nextcloud apps declaratively on NixOS, but I personally don't do so,
|
||||
so I will not detail the process here.
|
||||
|
||||
### Device configuration
|
||||
|
||||
To use UnifiedPush on your Android device you need to have both the
|
||||
[Nextcloud](https://f-droid.org/en/packages/com.nextcloud.client/) and the
|
||||
[NextPush](https://f-droid.org/en/packages/org.unifiedpush.distributor.nextpush/)
|
||||
app installed. Opening the NextPush app should guide you through setting it
|
||||
up. Once you've done that, you can start registering apps with NextPush. For
|
||||
example, to register Element Android go to the Notifications settings in Element
|
||||
Android and pick NextPush as your notification method. To set up Tusky, I
|
||||
haven't found a better way than logging out and back in again.
|
||||
|
||||
Once you've followed these steps, you should have a working push notification
|
||||
setup.
|
||||
|
||||
## Conclusion
|
||||
|
||||
As you can see, the process for setting up UnifiedPush using Nextcloud is not
|
||||
that involved. I was personally really impressed with how quickly I was able to
|
||||
get everything working. It is really nice to see that the open-source and free
|
||||
software community can implement the niceties that we've come to expect from
|
||||
modern life without needing a big tech giant to do so.
|
6
src/content/blog/_index.md
Normal file
6
src/content/blog/_index.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
+++
|
||||
title = "Posts"
|
||||
sort_by = "date"
|
||||
generate_feed = true
|
||||
page_template = "post.html"
|
||||
+++
|
58
src/sass/style.scss
Normal file
58
src/sass/style.scss
Normal file
|
@ -0,0 +1,58 @@
|
|||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
header {
|
||||
border-bottom: black 1px solid;
|
||||
padding: 0.5em;
|
||||
|
||||
section {
|
||||
display: inline;
|
||||
|
||||
+ section::before {
|
||||
content: '| ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main {
|
||||
padding: 0.5em;
|
||||
max-width: 60em;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
footer {
|
||||
border-top: black 1px solid;
|
||||
padding: 0.5em;
|
||||
section {
|
||||
display: inline;
|
||||
|
||||
+ section::before {
|
||||
content: '| ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
.post-list {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
li {
|
||||
list-style-type: none;
|
||||
}
|
||||
}
|
||||
|
||||
.inline-list {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
li {
|
||||
display: inline;
|
||||
list-style-type: none;
|
||||
&+ li::before {
|
||||
content: '/ '
|
||||
}
|
||||
}
|
||||
}
|
BIN
src/static/favicon.ico
Normal file
BIN
src/static/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
29
src/templates/base.html
Normal file
29
src/templates/base.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{% block title %} {% endblock %} | Charlotte Van Petegem</title>
|
||||
<link rel="alternate" type="application/atom+xml" title="Atom" href="{{ get_url(path="blog/atom.xml", trailing_slash=false) }}">
|
||||
<link rel="stylesheet" href="{{ get_url(path="/style.css") }}">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<section>
|
||||
<a href="{{ get_url(path="@/_index.md" )}}">Homepage</a>
|
||||
</section>
|
||||
<section>
|
||||
<a href="{{ get_url(path="@/blog/_index.md") }}">Blog</a>
|
||||
</section>
|
||||
</header>
|
||||
<main>
|
||||
{% block content %} {% endblock %}
|
||||
</main>
|
||||
<footer>
|
||||
<section><a href="{{ get_url(path="@/about.md") }}">About me</a></section>
|
||||
<section><a href="{{ get_url(path="blog/atom.xml", trailing_slash=false) }}">Atom/RSS</a></section>
|
||||
<section>This website was lovingly crafted using <a href="https://www.getzola.org" target="_blank" rel="noopener nofollow noreferrer">Zola</a>.</section>
|
||||
</ul>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
23
src/templates/index.html
Normal file
23
src/templates/index.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ section.title }}{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<p>
|
||||
Hi! Welcome to my website. It contains mostly blog posts. The three most recent
|
||||
blog posts are listed below. Some more info about me is contained in the
|
||||
appropiately named <a href="{{ get_url(path="@/about.md")}}">About me</a> page.
|
||||
</p>
|
||||
<h2>Most recent posts</h2>
|
||||
{% set blog_section = get_section(path="blog/_index.md") %}
|
||||
<ul class="post-list">
|
||||
{% for page in blog_section.pages | slice(end=3) %}
|
||||
<li>
|
||||
<p><a href="{{ page.permalink | safe }}">{{ page.title }}</a> ({{ page.date }})</p>
|
||||
<p>{{ page.summary | safe }}</p>
|
||||
<p><a href="{{ page.permalink }}#continue-reading">Continue reading…</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<a href="{{ get_url(path='@/blog/_index.md') }}">All posts</a>
|
||||
{% endblock content %}
|
8
src/templates/page.html
Normal file
8
src/templates/page.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ page.title }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ page.title }}</h1>
|
||||
{{ page.content | safe }}
|
||||
{% endblock content %}
|
15
src/templates/post.html
Normal file
15
src/templates/post.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ page.title }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ page.title }}<br><small>{{ page.date }}</small></h1>
|
||||
{{ page.content | safe }}
|
||||
|
||||
<p>
|
||||
Comments or questions about this post? Feel free to contact me <a
|
||||
target="_blank" href="https://social.chvp.be/@chvp">on Mastodon</a> or send
|
||||
me <a href="mailto:blog@chvp.be?subject={{page.title}}">an email</a>.
|
||||
</p>
|
||||
|
||||
{% endblock content %}
|
20
src/templates/section.html
Normal file
20
src/templates/section.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}
|
||||
{{ section.title }}
|
||||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<h1>
|
||||
{{ section.title }}
|
||||
</h1>
|
||||
<ul class="post-list">
|
||||
{% for page in section.pages %}
|
||||
<li>
|
||||
<p><a href="{{ page.permalink | safe }}">{{ page.title }}</a> ({{ page.date }})</p>
|
||||
<p>{{ page.summary | safe }}</p>
|
||||
<p><a href="{{ page.permalink }}#continue-reading">Continue reading…</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock content %}
|
14
src/templates/taxonomy_list.html
Normal file
14
src/templates/taxonomy_list.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ taxonomy.name }}{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">
|
||||
{{ taxonomy.name }}
|
||||
</h1>
|
||||
<ul class="inline-list">
|
||||
{% for term in terms %}
|
||||
<li><a href="{{ term.permalink }}">{{ term.name}}</a> ({{ term.pages | length }})</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock content %}
|
18
src/templates/taxonomy_single.html
Normal file
18
src/templates/taxonomy_single.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ term.name }}{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title" >
|
||||
{{ term.name }}
|
||||
</h1>
|
||||
<ul class="post-list">
|
||||
{% for page in term.pages %}
|
||||
<li>
|
||||
<h4><a href="{{ page.permalink | safe }}">{{ page.title }}</a></h4>
|
||||
<p>{{ page.summary | safe }}</p>
|
||||
<p><a href="{{ page.permalink }}#continue-reading">Continue reading…</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock content %}
|
Loading…
Add table
Add a link
Reference in a new issue