e16a0988bc
This commit readds and updates the 1.x package from 1.1.4 to 1.1.6 which also includes the needed command for migrating to 2.x The module is adjusted to the version change, defaulting to radicale2 if stateVersion >= 17.09 and radicale1 otherwise. It also now uses ExecStart instead of the script service attribute. Some missing dots at the end of sentences were also added. I added a paragraph in the release notes on how to update to a newer version.
82 lines
2 KiB
Nix
82 lines
2 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.radicale;
|
|
|
|
confFile = pkgs.writeText "radicale.conf" cfg.config;
|
|
|
|
# This enables us to default to version 2 while still not breaking configurations of people with version 1
|
|
defaultPackage = if versionAtLeast "17.09" config.system.stateVersion then {
|
|
pkg = pkgs.radicale2;
|
|
text = "pkgs.radicale2";
|
|
} else {
|
|
pkg = pkgs.radicale1;
|
|
text = "pkgs.radicale1";
|
|
};
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
services.radicale.enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Enable Radicale CalDAV and CardDAV server.
|
|
'';
|
|
};
|
|
|
|
services.radicale.package = mkOption {
|
|
type = types.package;
|
|
default = defaultPackage.pkg;
|
|
defaultText = defaultPackage.text;
|
|
description = ''
|
|
Radicale package to use. This defaults to version 1.x if
|
|
<literal>system.stateVersion < 17.09</literal> and version 2.x
|
|
otherwise.
|
|
'';
|
|
};
|
|
|
|
services.radicale.config = mkOption {
|
|
type = types.string;
|
|
default = "";
|
|
description = ''
|
|
Radicale configuration, this will set the service
|
|
configuration file.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
environment.systemPackages = [ cfg.package ];
|
|
|
|
users.extraUsers = singleton
|
|
{ name = "radicale";
|
|
uid = config.ids.uids.radicale;
|
|
description = "radicale user";
|
|
home = "/var/lib/radicale";
|
|
createHome = true;
|
|
};
|
|
|
|
users.extraGroups = singleton
|
|
{ name = "radicale";
|
|
gid = config.ids.gids.radicale;
|
|
};
|
|
|
|
systemd.services.radicale = {
|
|
description = "A Simple Calendar and Contact Server";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
ExecStart = "${cfg.package}/bin/radicale -C ${confFile} -f";
|
|
User = "radicale";
|
|
Group = "radicale";
|
|
};
|
|
};
|
|
};
|
|
|
|
meta.maintainers = with lib.maintainers; [ aneeshusa infinisil ];
|
|
}
|