438821de68
Flake lock file updates: • Updated input 'nixpkgs': 'github:nixos/nixpkgs/a4d4fe8c5002202493e87ec8dbc91335ff55552c' (2024-02-15) → 'github:nixos/nixpkgs/5863c27340ba4de8f83e7e3c023b9599c3cb3c80' (2024-02-16) • Updated input 'sops-nix': 'github:Mic92/sops-nix/48afd3264ec52bee85231a7122612e2c5202fa74' (2024-02-13) → 'github:Mic92/sops-nix/ffed177a9d2c685901781c3c6c9024ae0ffc252b' (2024-02-18) • Updated input 'sops-nix/nixpkgs': 'github:NixOS/nixpkgs/442d407992384ed9c0e6d352de75b69079904e4e' (2024-02-09) → 'github:NixOS/nixpkgs/6e2f00c83911461438301db0dba5281197fe4b3a' (2024-02-17) • Updated input 'sops-nix/nixpkgs-stable': 'github:NixOS/nixpkgs/d8cd80616c8800feec0cab64331d7c3d5a1a6d98' (2024-02-10) → 'github:NixOS/nixpkgs/69405156cffbdf2be50153f13cbdf9a0bea38e49' (2024-02-17) |
||
---|---|---|
.github/workflows | ||
demo | ||
docs | ||
lib | ||
modules | ||
test | ||
.gitignore | ||
flake.lock | ||
flake.nix | ||
LICENSE | ||
README.md |
Self Host Blocks
Building blocks for self-hosting with battery included.
SHB's (Self Host Blocks) is yet another server management tool whose goal is to provide a lower entry-bar for self-hosting. SHB provides opinionated building blocks fitting together to self-host any service you'd want. Some common services are provided out of the box.
To achieve this, SHB is using the full power of NixOS modules. Indeed, each building block and each service is a NixOS module and uses the modules defined in Nixpkgs.
TOC
Usage
Caution: You should know that although I am using everything in this repo for my personal production server, this is really just a one person effort for now and there are most certainly bugs that I didn't discover yet.
Self Host Blocks is available as a flake. To use it in your project, add the following flake input:
inputs.selfhostblocks.url = "github:ibizaman/selfhostblocks";
See the manual for more information about installing Self Host Blocks.
- You are new to self hosting and want pre-configured services to deploy easily. Look at the services section.
- You are a seasoned self-hoster but want to enhance some services you deploy already. Go to the blocks section.
- You are a user of Self Host Blocks but would like to use your own implementation for a block. Head over to the matrix channel to talk about it (this is WIP).
Why yet another self hosting tool?
By using Self Host Blocks, you get all the benefits of NixOS which are, for self hosted applications specifically:
- declarative configuration;
- atomic configuration rollbacks;
- real programming language to define configurations;
- user-defined abstractions (create your own functions or NixOS modules on top of SHB!);
- integration with the rest of nixpkgs.
In no particular order, here are some aspects of SHB which I find interesting and differentiates it from other server management projects:
- SHB intends to be a library, not a framework. You can either go all in and use SHB provided services directly or use just one block in your existing infrastructure.
- SHB introduces contracts to allow you to swap implementation for each self-hosting need. For example, you should be able to use the reverse proxy you want without modifying any services depending on it.
- SHB contracts also allows you to use your own custom implementation instead of the provided one, as long as it follows the contract and passes the tests.
- SHB provides at least one implementation for each self-hosting need like backups, SSL certificates, reverse proxy, VPN, etc. Those are called blocks here. They are documented in the manual.
- SHB follows nixpkgs unstable branch closely. There is a GitHub action running daily that updates
the
nixpkgs
input in the rootflakes.nix
, runs the tests and merges a PR with the new input if the tests pass.
Manual
The manual can be found at shb.skarabox.com.
Currently, only some services and blocks are documented. For the rest, unfortunately the source code is the best place to read about them. Here for services and here for blocks.
Roadmap
Currently, the Nextcloud service and SSL block are the most advanced and most documented.
Documenting all services and blocks will be done as I make all blocks and services use the contracts.
Upstreaming changes is also on the roadmap.
Check the issues to see planned works.
That being said, I am personally using all the blocks and services in this project, so they do work.
Available Blocks
authelia.nix
for Single Sign On.backup.nix
.ldap.nix
for user management.monitoring.nix
for dashboards, logs and alerts.nginx.nix
for reverse proxy with SSL termination.postgresql.nix
for database setup.ssl.nix
for maintaining self-signed SSL certificates or certificates provided by Let's Encrypt.tinyproxy.nix
to forward traffic to a VPN tunnel.vpn.nix
to setup a VPN tunnel.
Provided Services
arr.nix
for finding media https://wiki.servarr.com/.deluge.nix
for downloading linux isos https://deluge-torrent.org/.hledger.nix
for managing finances https://hledger.org/.home-assistant.nix
for private IoT https://www.home-assistant.io/.jellyfin.nix
for watching media https://jellyfin.org/.- Nextcloud Server for private documents, contacts, calendar, etc https://nextcloud.com.
vaultwarden.nix
for passwords https://github.com/dani-garcia/vaultwarden.
Demos
Demos that start and deploy a service on a Virtual Machine on your computer are located under the demo folder. These show the onboarding experience you would get if you deployed one of the services on your own server.
Community
All issues and PRs are welcome. For PRs, if they are substantial changes, please open an issue to discuss the details first. More details in here.
Come hang out in the Matrix channel. :)
One aspect that's close to my heart is I intent to make SHB the lightest layer on top of nixpkgs as possible. I want to upstream as much as possible. I will still take some time to experiment here but when I'm satisfied with how things look, I'll upstream changes.
License
I'm following the Nextcloud license which is AGPLv3. See this article from the FSF that explains what this license adds to the GPL one.