1
1
Fork
You've already forked haven-nix
0
Haven Nostr Relay for NixOS
  • Nix 100%
2025年03月21日 22:25:57 -03:00
.gitignore Initial package and module 2025年03月21日 15:26:21 -03:00
flake.lock Initial package and module 2025年03月21日 15:26:21 -03:00
flake.nix Initial package and module 2025年03月21日 15:26:21 -03:00
LICENSE Initial commit 2025年03月21日 17:35:59 +00:00
module.nix Update readme 2025年03月21日 22:25:57 -03:00
package.nix fix missing templates 2025年03月21日 18:48:52 -03:00
README.md Update readme 2025年03月21日 22:25:57 -03:00

Haven NixOS Module & Package

This repository provides a Nix module and package definition for Haven, a self-hosted Nostr relay and blossom server.

What is provided

  • A reproducible Nix package for Haven.
  • A declarative NixOS module that:
    • Configures Haven as a systemd service.
    • Creates a persistent stateDir with relay database and blossom files.
    • Allows full customization of relay behavior (chat, inbox, outbox, etc).
    • Provides sensible defaults for relays settings, limits, and descriptions.

Usage

Module Configuration

{
 inputs.haven.url = "git+https://codeberg.org/karl/haven-nix";
 outputs = { self, nixpkgs, haven, ... }:
 let
 system = "x86_64-linux";
 pkgs = import nixpkgs { inherit system; };
 in {
 nixosConfigurations.my-host = pkgs.lib.nixosSystem {
 inherit system;
 modules = [
 haven.nixosModules.haven
 ./my-config.nix
 ];
 };
 };
}
{
 services.haven = let
 commonRelays = [
 "relay.damus.io"
 "nos.lol"
 "relay.nostr.band"
 ];
 in {
 enable = true;
 relayUrl = "relay.example.com";
 relayPort = 3355;
 ownerNpub = "npub1...";
 privateRelayName = "Private";
 chatRelayName = "Chat";
 outboxRelayName = "Outbox";
 inboxRelayName = "Inbox";
 importSeedRelays = commonRelays ++ [ "relay.extra.com" ];
 blastrRelays = commonRelays;
 };
}

Package Details

The Haven binary is built via buildGoModule using Go modules and vendoring. The templates/ directory (required at runtime) is included in the package and symlinked to ${stateDir}/templates at service startup when using the module.

Limitations

  • No binary cache: builds are local unless you set up Cachix or similar.
  • No module tests yet: systemd service and integration tests will be added.
  • Templates are not customizable: Haven expects them to be in ./templates. Currently symlinked into stateDir, but not user-configurable.

Planned Improvements

  • Add templatesDir option to configure Haven template path.
  • Add integration tests via nixosTest.
  • Set up a binary cache for the Haven package.

Credits

  • Haven
  • Nix/NixOS community and the authors of existing service modules for inspiration.

PRs welcome!