added credentials file

This commit is contained in:
Stuce 2025-11-16 10:55:01 +01:00
parent 3a2241e434
commit 87a645d0fc
3 changed files with 82 additions and 46 deletions

View file

@ -33,33 +33,57 @@
nixosModules.caldavToCsv = { config, lib, ... }:
let cfg = config.services.caldavToCsv;
in {
options.NixosModule = {
enable = lib.mkEnableOption "Enable calDAVtoCSV service";
port = lib.mkOption {
type = lib.types.int;
default = 8000;
description = "Port on which calDAVtoCSV will listen";
options.calDavtoCSV = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable myService";
};
url = lib.mkOption {
type = lib.types.str;
description = "url of the calendar";
};
calendarUsername = lib.mkOption {
type = lib.types.str;
description = "username of the calendar account";
};
calendarName = lib.mkOption {
type = lib.types.str;
description =
"name of the calendar we will fetch the todo items from";
};
calendarPasswordFile = lib.mkOption {
type = lib.types.str;
description =
"file where we need to look for password to connect, needs to be readeable by the service user";
config = lib.mkOption {
type = lib.types.attrs;
default = {
calDAV = {
address = "localhost:5232";
username = "username";
password = "password";
passwordFile = "/path/to/password";
};
server = { port = 8000; };
};
description = "User-defined configuration for the service";
};
};
# options.NixosModule = {
# enable = lib.mkEnableOption "Enable calDAVtoCSV service";
# port = lib.mkOption {
# type = lib.types.int;
# default = 8000;
# description = "Port on which calDAVtoCSV will listen";
# };
# url = lib.mkOption {
# type = lib.types.str;
# description = "url of the calendar";
# };
# calendarUsername = lib.mkOption {
# type = lib.types.str;
# description = "username of the calendar account";
# };
# calendarName = lib.mkOption {
# type = lib.types.str;
# description =
# "name of the calendar we will fetch the todo items from";
# };
# calendarPasswordFile = lib.mkOption {
# type = lib.types.str;
# description =
# "file where we need to look for password to connect, needs to be readeable by the service user";
# };
# };
config = lib.mkIf config.myModule.enable {
environment.etc."config.ini".text = ''
${lib.toIni config.myService.config}
'';
systemd.services.calDAVtoCSV = {
description = "calDAV to CSV Service";
after = [ "network.target" ];