NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.08k stars 14.13k forks source link

Radicale DecSync #124881

Open ksiezak opened 3 years ago

ksiezak commented 3 years ago

Project description Radicale DecSync is an Radicale storage plugin which adds synchronization of contacts and calendars using DecSync. This allows you to use DecSync on any CalDAV/CardDAV compatible client like Thunderbird.

Metadata

ethancedwards8 commented 3 years ago

I'll gladly package it. But my question is could you write the module? I've never used this before, and I don't see myself ever using it so I really have no way to test it.

ethancedwards8 commented 3 years ago

I have this so far:

{ lib, python3Packages, radicale }:

python3Packages.buildPythonApplication rec {
  pname = "radicale-decsync";
  version = "1.2.2";

  src = python3Packages.fetchPypi {
    pname = "radicale-storage-decsync";
    inherit version;
    sha256 = "0000000000000000000000000000000000000000000000000000";
  };

  propagatedBuildInputs = [ python3Packages.libdecsync radicale ];

  meta = with lib; {
    description = "Radicale storage plugin to add synchronization using DecSync";
    homepage = "https://github.com/39aldo39/Radicale-DecSync";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [  ];
  };

}

Feel free to carry on with it and finish it, I'm going to work on other things.

ksiezak commented 3 years ago

@ethancedwards8 I would gladly finish and test this, but so far I am a total nix newbie. Could you point me at the right direction, what else should be done to complete this?

ethancedwards8 commented 3 years ago

@ethancedwards8 I would gladly finish and test this, but so far I am a total nix newbie. Could you point me at the right direction, what else should be done to complete this?

https://github.com/NixOS/nixpkgs/pull/127632 You would need to pick this up, finish the package above, and then work on the main Radicale package to allow plugins like this one. Have fun!

stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info

lbartl commented 2 years ago

I use the following home-manager configuration for Radicale with DecSync:

{ config, pkgs, lib, ... }:

let
  libdecsync = pkgs.python3Packages.buildPythonPackage rec {
    pname = "libdecsync";
    version = "2.2.1";

    src = pkgs.python3Packages.fetchPypi {
      inherit pname version;
      hash = "sha256-Mukjzjumv9VL+A0maU0K/SliWrgeRjAeiEdN5a83G0I=";
    };
  };
  radicale-storage-decsync = pkgs.python3Packages.buildPythonPackage rec {
    pname = "radicale_storage_decsync";
    version = "2.1.0";

    src = pkgs.python3Packages.fetchPypi {
      inherit pname version;
      hash = "sha256-X+0MT5o2PjsKxca5EDI+rYyQDmUtbRoELDr6e4YXKCg=";
    };

    buildInputs = [ pkgs.radicale ];
    propagatedBuildInputs = [ libdecsync pkgs.python3Packages.setuptools ];
  };
  radicale-decsync = pkgs.radicale.overrideAttrs (old: {
    propagatedBuildInputs = old.propagatedBuildInputs ++ [ radicale-storage-decsync ];
  });
  radicale-config = pkgs.writeText "radicale-config"
    ''
      [storage]
      type = radicale_storage_decsync
      filesystem_folder = ${config.xdg.dataHome}/radicale
      decsync_dir = ${config.xdg.dataHome}/decsync
    '';
in
  {
    systemd.user.services.radicale = {
      Unit.Description = "Radicale with DecSync";
      Service = {
        ExecStart = "${radicale-decsync}/bin/radicale -C ${radicale-config}";
        Restart = "on-failure";
      };
      Install.WantedBy = [ "default.target" ];
    };
  }

It's not perfect, it uses the precompiled libdecsync from the python package (this was also an issue in #127632, but I did not manage to compile it with nix) and it uses radicale as buildInput for radicale-storage-decsync and then overrides the propagatedBuildInputs of radicale, but I don't know if there is a better way.