From 20dcc6648af67376db75ee6eafb606a0ec2ce2cd Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Sat, 4 Oct 2025 00:50:45 +0200 Subject: [PATCH] memos: Init module --- modules/system/services/memos.nix | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 modules/system/services/memos.nix diff --git a/modules/system/services/memos.nix b/modules/system/services/memos.nix new file mode 100644 index 0000000..26864a3 --- /dev/null +++ b/modules/system/services/memos.nix @@ -0,0 +1,45 @@ +{ + config, + options, + modulesPath, + inputs, + pkgs-unstable, + lib, + ... +}: +let + cfg = config.custom.services.memos; +in +{ + imports = [ "${inputs.nixpkgs-unstable}/nixos/modules/services/misc/memos.nix" ]; + + options.custom.services.memos = { + enable = lib.mkEnableOption ""; + domain = lib.mkOption { + type = lib.types.nonEmptyStr; + default = ""; + }; + port = lib.mkOption { + type = lib.types.port; + default = 5230; + }; + }; + + config = lib.mkIf cfg.enable { + warnings = lib.optional (lib.pathExists "${modulesPath}/services/misc/memos.nix") "TODO: Use memos module from stable nixpkgs"; + + meta = { + domains.list = [ cfg.domain ]; + ports.tcp.list = [ cfg.port ]; + }; + + services.memos = { + enable = true; + package = pkgs-unstable.memos; + settings = options.services.memos.settings.default // { + MEMOS_PORT = builtins.toString cfg.port; + MEMOS_INSTANCE_URL = "https://${cfg.domain}"; + }; + }; + }; +}