Merge pull request #27826 from Infinisil/radicale
radicale: update to version 2
This commit is contained in:
commit
7d1d019650
|
@ -101,6 +101,9 @@ rmdir /var/lib/ipfs/.ipfs
|
|||
<para>
|
||||
The <literal>mysql</literal> default <literal>dataDir</literal> has changed from <literal>/var/mysql</literal> to <literal>/var/lib/mysql</literal>.
|
||||
</para>
|
||||
<para>
|
||||
Radicale's default package has changed from 1.x to 2.x. Instructions to migrate can be found <link xlink:href="http://radicale.org/1to2/"> here </link>. It is also possible to use the newer version by setting the <literal>package</literal> to <literal>radicale2</literal>, which is done automatically when <literal>stateVersion</literal> is 17.09 or higher.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{config, lib, pkgs, ...}:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
|
@ -8,17 +8,35 @@ let
|
|||
|
||||
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
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -27,13 +45,13 @@ in
|
|||
default = "";
|
||||
description = ''
|
||||
Radicale configuration, this will set the service
|
||||
configuration file
|
||||
configuration file.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ pkgs.radicale ];
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
users.extraUsers = singleton
|
||||
{ name = "radicale";
|
||||
|
@ -52,11 +70,13 @@ in
|
|||
description = "A Simple Calendar and Contact Server";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = "${pkgs.radicale}/bin/radicale -C ${confFile} -f";
|
||||
serviceConfig.User = "radicale";
|
||||
serviceConfig.Group = "radicale";
|
||||
serviceConfig = {
|
||||
ExecStart = "${cfg.package}/bin/radicale -C ${confFile} -f";
|
||||
User = "radicale";
|
||||
Group = "radicale";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
meta.maintainers = with lib.maintainers; [ aneeshusa ];
|
||||
meta.maintainers = with lib.maintainers; [ aneeshusa infinisil ];
|
||||
}
|
||||
|
|
|
@ -298,6 +298,7 @@ in rec {
|
|||
tests.pumpio = callTest tests/pump.io.nix {};
|
||||
# tests.quagga = callTest tests/quagga.nix {};
|
||||
tests.quake3 = callTest tests/quake3.nix {};
|
||||
tests.radicale = callTest tests/radicale.nix {};
|
||||
tests.runInMachine = callTest tests/run-in-machine.nix {};
|
||||
tests.samba = callTest tests/samba.nix {};
|
||||
tests.sddm = callSubTests tests/sddm.nix {};
|
||||
|
|
|
@ -1,80 +1,39 @@
|
|||
let
|
||||
port = 5232;
|
||||
radicaleOverlay = self: super: {
|
||||
radicale = super.radicale.overrideAttrs (oldAttrs: {
|
||||
propagatedBuildInputs = with self.pythonPackages;
|
||||
(oldAttrs.propagatedBuildInputs or []) ++ [
|
||||
passlib
|
||||
];
|
||||
});
|
||||
};
|
||||
common = { config, pkgs, ...}: {
|
||||
user = "someuser";
|
||||
password = "some_password";
|
||||
port = builtins.toString 5232;
|
||||
in
|
||||
import ./make-test.nix ({ pkgs, lib, ... }: {
|
||||
name = "radicale";
|
||||
meta.maintainers = with lib.maintainers; [ aneeshusa infinisil ];
|
||||
|
||||
machine = {
|
||||
services.radicale = {
|
||||
enable = true;
|
||||
config = let home = config.users.extraUsers.radicale.home; in ''
|
||||
[server]
|
||||
hosts = 127.0.0.1:${builtins.toString port}
|
||||
daemon = False
|
||||
[encoding]
|
||||
[well-known]
|
||||
config = ''
|
||||
[auth]
|
||||
type = htpasswd
|
||||
htpasswd_filename = /etc/radicale/htpasswd
|
||||
htpasswd_encryption = bcrypt
|
||||
[git]
|
||||
[rights]
|
||||
|
||||
[storage]
|
||||
type = filesystem
|
||||
filesystem_folder = ${home}/collections
|
||||
filesystem_folder = /tmp/collections
|
||||
|
||||
[logging]
|
||||
[headers]
|
||||
debug = True
|
||||
'';
|
||||
};
|
||||
# WARNING: DON'T DO THIS IN PRODUCTION!
|
||||
# This puts secrets (albeit hashed) directly into the Nix store for ease of testing.
|
||||
environment.etc."radicale/htpasswd".source = with pkgs; let
|
||||
py = python.withPackages(ps: with ps; [ passlib ]);
|
||||
in runCommand "htpasswd" {} ''
|
||||
${py}/bin/python -c "
|
||||
from passlib.apache import HtpasswdFile
|
||||
ht = HtpasswdFile(
|
||||
'$out',
|
||||
new=True,
|
||||
default_scheme='bcrypt'
|
||||
)
|
||||
ht.set_password('someuser', 'really_secret_password')
|
||||
ht.save()
|
||||
"
|
||||
environment.etc."radicale/htpasswd".source = pkgs.runCommand "htpasswd" {} ''
|
||||
${pkgs.apacheHttpd}/bin/htpasswd -bcB "$out" ${user} ${password}
|
||||
'';
|
||||
};
|
||||
|
||||
in import ./make-test.nix ({ lib, ... }: {
|
||||
name = "radicale";
|
||||
meta.maintainers = with lib.maintainers; [ aneeshusa ];
|
||||
|
||||
# Test radicale with bcrypt-based htpasswd authentication
|
||||
nodes = {
|
||||
py2 = { config, pkgs, ... }@args: (common args) // {
|
||||
nixpkgs.overlays = [
|
||||
radicaleOverlay
|
||||
];
|
||||
};
|
||||
py3 = { config, pkgs, ... }@args: (common args) // {
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
python = self.python3;
|
||||
pythonPackages = self.python3.pkgs;
|
||||
})
|
||||
radicaleOverlay
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# This tests whether the web interface is accessible to an authenticated user
|
||||
testScript = ''
|
||||
for my $machine ($py2, $py3) {
|
||||
$machine->waitForUnit('radicale.service');
|
||||
$machine->waitForOpenPort(${builtins.toString port});
|
||||
$machine->succeed('curl -s http://someuser:really_secret_password@127.0.0.1:${builtins.toString port}/someuser/calendar.ics/');
|
||||
}
|
||||
$machine->waitForUnit('radicale.service');
|
||||
$machine->waitForOpenPort(${port});
|
||||
$machine->succeed('curl --fail http://${user}:${password}@localhost:${port}/.web/');
|
||||
'';
|
||||
})
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
{ stdenv, fetchurl, pythonPackages }:
|
||||
|
||||
pythonPackages.buildPythonApplication rec {
|
||||
name = "radicale-${version}";
|
||||
version = "1.1.6";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://pypi/R/Radicale/Radicale-${version}.tar.gz";
|
||||
sha256 = "0ay90nj6fmr2aq8imi0mbjl4m2rzq7a83ikj8qs9gxsylj71j1y0";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = stdenv.lib.optionals (!pythonPackages.isPy3k) [
|
||||
pythonPackages.flup
|
||||
pythonPackages.ldap
|
||||
pythonPackages.sqlalchemy
|
||||
];
|
||||
|
||||
doCheck = !pythonPackages.isPy3k;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = http://www.radicale.org/;
|
||||
description = "CalDAV CardDAV server";
|
||||
longDescription = ''
|
||||
The Radicale Project is a complete CalDAV (calendar) and CardDAV
|
||||
(contact) server solution. Calendars and address books are available for
|
||||
both local and remote access, possibly limited through authentication
|
||||
policies. They can be viewed and edited by calendar and contact clients
|
||||
on mobile phones or computers.
|
||||
'';
|
||||
license = licenses.gpl3Plus;
|
||||
platforms = platforms.all;
|
||||
maintainers = with maintainers; [ edwtjo pSub aneeshusa ];
|
||||
};
|
||||
}
|
|
@ -1,21 +1,27 @@
|
|||
{ stdenv, fetchurl, pythonPackages }:
|
||||
{ stdenv, fetchFromGitHub, python3Packages }:
|
||||
|
||||
pythonPackages.buildPythonApplication rec {
|
||||
let
|
||||
version = "2.1.2";
|
||||
sha256 = "0gmbnvm17j0ilcnci1k2jh0vkbz5g8xlk9lgia5mlx790048hlm8";
|
||||
in
|
||||
|
||||
python3Packages.buildPythonApplication {
|
||||
name = "radicale-${version}";
|
||||
version = "1.1.4";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://pypi/R/Radicale/Radicale-${version}.tar.gz";
|
||||
sha256 = "17p0hayyw30pfb81xqvd7jhjm6yrk2dnbgvqagx1nqdsr89ar0ss";
|
||||
src = fetchFromGitHub {
|
||||
owner = "Kozea";
|
||||
repo = "Radicale";
|
||||
rev = version;
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
propagatedBuildInputs = stdenv.lib.optionals (!pythonPackages.isPy3k) [
|
||||
pythonPackages.flup
|
||||
pythonPackages.ldap
|
||||
pythonPackages.sqlalchemy
|
||||
];
|
||||
doCheck = false;
|
||||
|
||||
doCheck = !pythonPackages.isPy3k;
|
||||
propagatedBuildInputs = with python3Packages; [
|
||||
vobject
|
||||
passlib
|
||||
];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = http://www.radicale.org/;
|
||||
|
@ -29,6 +35,6 @@ pythonPackages.buildPythonApplication rec {
|
|||
'';
|
||||
license = licenses.gpl3Plus;
|
||||
platforms = platforms.all;
|
||||
maintainers = with maintainers; [ edwtjo pSub aneeshusa ];
|
||||
maintainers = with maintainers; [ edwtjo pSub aneeshusa infinisil ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11545,7 +11545,10 @@ with pkgs;
|
|||
inherit (darwin.apple_sdk.frameworks) AppKit Carbon Cocoa;
|
||||
};
|
||||
|
||||
radicale = callPackage ../servers/radicale { };
|
||||
radicale1 = callPackage ../servers/radicale/1.x.nix { };
|
||||
radicale2 = callPackage ../servers/radicale/default.nix { };
|
||||
|
||||
radicale = radicale2;
|
||||
|
||||
rake = callPackage ../development/tools/build-managers/rake { };
|
||||
|
||||
|
|
Loading…
Reference in New Issue