Jump to content

Lauti: Difference between revisions

From NixOS Wiki
Klinger (talk | contribs)
m Removed the "will be stable stable starting from 24.11" notice
Onny (talk | contribs)
Add Radar sync script example
Line 50: Line 50:


}
}
</syntaxhighlight>
== Tips and tricks ==
=== Sync events from Radar to Eintopf ===
The following script can be imported into the NixOS system configuration and will runs every half an hour to sync events from a given Radar group id to a specific target Eintopf instance.
Import the module and script into your system <code>flake.nix</code> file<syntaxhighlight lang="nix">
{
  inputs = {
    eintopf-radar-sync.url = "git+https://git.project-insanity.org/onny/eintopf-radar-sync.git";
    [...]
  };
  outputs = {self, nixpkgs, ...}@inputs: {
    nixosConfigurations.my_system = inputs.nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs.inputs = inputs;
      modules = [
        inputs.eintopf-radar-sync.nixosModule
        ({ pkgs, ... }:{
          nixpkgs.overlays = [
            inputs.eintopf-radar-sync.overlay
          ];
        })
        ./configuration.nix
      ];
    };
  };
}
</syntaxhighlight>Enable the sync service in your system configuration by adding following snippet. Replace the setting variables according to your setup<syntaxhighlight lang="nix">
services.eintopf-radar-sync = {
  enable = true;
  settings = {
    eintopfUrl = "karlsunruh.project-insanity.org";
    eintopfAuthorizationToken = "SECRET TOKEN";
    radarGroupId = "436012";
  };
};
</syntaxhighlight>
</syntaxhighlight>
[[Category:Server]]
[[Category:Server]]
[[Category:Web Applications]]
[[Category:Web Applications]]

Revision as of 10:45, 12 March 2025

Eintopf is a community event calendar for groups and places.

Setup

A minimal local example setup would look like this

environment.etc."eintopf-secrets".text = ''
EINTOPF_ADMIN_PASSWORD=test123
'';

services.eintopf = {
  enable = true;
  settings.EINTOPF_ADMIN_EMAIL = "test@example.org";
  secrets = [ /etc/eintopf-secrets ];
};

The web service will be available at http://localhost:3333. The administration login page is available at http://localhost:3333/backstage where you can use the credentials specified above.

Configuration

Templates

Following example packages the "karlsunruh" template and set it as default for Eintopf.

{ pkgs, ... }:
let

  template-karlsunruh = pkgs.stdenv.mkDerivation {
    name = "karlsunruh";
    src = pkgs.fetchgit {
      url = "https://git.project-insanity.org/onny/eintopf-karlsunruh.git";
      rev = "81cb96424b1162b6dd20c1b22f03dbdf49ae30d4";
      hash = "sha256-+OeZG6+yZ0CwuIEN7pc0MankepZ6npiOD8RMyvWhQrY=";
    };
    dontBuild = true;
    installPhase = ''
      cp -r . $out/
    '';
  };

in
{

  services.eintopf = {
    enable = true;
    settings = {
      EINTOPF_THEMES = "eintopf,${template-karlsunruh}";
    };
  };

}

Tips and tricks

Sync events from Radar to Eintopf

The following script can be imported into the NixOS system configuration and will runs every half an hour to sync events from a given Radar group id to a specific target Eintopf instance.

Import the module and script into your system flake.nix file

{
  inputs = {
    eintopf-radar-sync.url = "git+https://git.project-insanity.org/onny/eintopf-radar-sync.git";
    [...]
  };

  outputs = {self, nixpkgs, ...}@inputs: {

    nixosConfigurations.my_system = inputs.nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs.inputs = inputs;
      modules = [
        inputs.eintopf-radar-sync.nixosModule

        ({ pkgs, ... }:{

          nixpkgs.overlays = [
            inputs.eintopf-radar-sync.overlay
          ];

        })

        ./configuration.nix

      ];
    };
  };
}

Enable the sync service in your system configuration by adding following snippet. Replace the setting variables according to your setup

services.eintopf-radar-sync = {
  enable = true;
  settings = {
    eintopfUrl = "karlsunruh.project-insanity.org";
    eintopfAuthorizationToken = "SECRET TOKEN";
    radarGroupId = "436012";
  };
};