From c24c659ee18c4652ae17f25cb1657323f4cda14c Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Wed, 4 Sep 2024 16:07:49 +0200 Subject: [PATCH] modules/ubus: init Signed-off-by: Raito Bezarius --- modules/ubus/default.nix | 24 ++++++++++++++++++++++++ modules/ubus/service.nix | 13 +++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 modules/ubus/default.nix create mode 100644 modules/ubus/service.nix diff --git a/modules/ubus/default.nix b/modules/ubus/default.nix new file mode 100644 index 0000000..827f537 --- /dev/null +++ b/modules/ubus/default.nix @@ -0,0 +1,24 @@ +## ubus +## ==== +## +## ubus is a micro-bus à la D-Bus for all your needs. + +{ lib, pkgs, config, ...}: +let + inherit (lib) mkOption types; + inherit (pkgs) liminix; +in { + options = { + system.service.ubus = mkOption { + type = liminix.lib.types.serviceDefn; + }; + }; + config = { + system.service.ubus = liminix.callService ./service.nix { + package = mkOption { + type = types.package; + default = pkgs.ubus; + }; + }; + }; +} diff --git a/modules/ubus/service.nix b/modules/ubus/service.nix new file mode 100644 index 0000000..e1e297e --- /dev/null +++ b/modules/ubus/service.nix @@ -0,0 +1,13 @@ +{ + liminix +, writeText +, lib +}: +{ package } : +let + inherit (liminix.services) longrun; +in longrun { + # Long term: make it unique so that user can spawn multiple buses if they want. + name = "ubus"; + run = "${package}/bin/ubusd"; +}