Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add infrastructure for contacts and calendars #4078

Merged
merged 6 commits into from
Jun 12, 2023

Conversation

teto
Copy link
Collaborator

@teto teto commented Jun 10, 2023

This also adds the modules

  • programs.vdirsyncer,
  • programs.khal, and
  • services.vdirsyncer

that integrate with the new infrastructure.

Co-authored-by: Andrew Scott 3648487+ayyjayess@users.noreply.github.com
Co-authored-by: Sebastian Zivota sebastian.zivota@mailbox.org

Description

This is a rebased version of the longstanding PR ( > 3 years ?) made to add contact and calendar support.
I've commented out "locale" support for khal since it was causing issues.

With it in its current state I was able to configure vdirsyncer and khal.
My proposition is to merge this wiht all its faults otherwise we can still wait 4 years before having anything working.
We have 6 months before release to iron things out and until then we make it clear that the module is experimental.

Checklist

  • Change is backwards compatible.

  • Code formatted with ./format.

  • Code tested through nix-shell --pure tests -A run.all or nix develop --ignore-environment .#all using Flakes.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.

Sebastian Zivota and others added 6 commits June 10, 2023 23:26
This also adds the modules

  - programs.vdirsyncer,
  - programs.khal, and
  - services.vdirsyncer

that integrate with the new infrastructure.

Co-authored-by: Andrew Scott <3648487+ayyjayess@users.noreply.github.com>
Co-authored-by: Sebastian Zivota <sebastian.zivota@mailbox.org>

wip
1. account option `userName` is now allowed by `programs.vdirsyncer`

2. The commented out account option `userNameCommand` was required to be set
   by `programs.vdirsyncer` (e.g. as `null`).
   It is now disallowed (commented out) by vdirsyncer.
... at .../modules/programs/vdirsyncer.nix:117:38
change to listString
@teto teto merged commit b01eb1e into nix-community:master Jun 12, 2023
3 checks passed
@teto teto deleted the calendar-contact-infra branch June 12, 2023 21:21
@ncfavier
Copy link
Member

What about #3912?

@teto
Copy link
Collaborator Author

teto commented Jun 12, 2023

#3912 is nowhere close to this old contact branch. This is much better as it generates the config for you.

@teto
Copy link
Collaborator Author

teto commented Jun 12, 2023

also just in case you are not on the chat, I actually asked on matrix before merging. To sum up it's not perfect but let's merge and make it as good as the mail infra #2335 (comment)

@teto teto mentioned this pull request Jun 13, 2023
6 tasks
@DanielSiepmann
Copy link
Contributor

Is there a way to exclude the new WIP modules in my local setup?
I already have a working vdirsync module for myself. This now conflicts with the new upstream provided by this PR.
And I can't migrate to upstream, due to still incomplete accounts modules.

That's why I would like to exclude the upstream vdirsync until its done.

@ncfavier
Copy link
Member

ncfavier commented Jun 13, 2023

disabledModules = [ "programs/vdirsyncer.nix" ]; should do it, at the same level as imports, config, options...

See https://nixos.org/manual/nixos/unstable/#sec-replace-modules

@teto
Copy link
Collaborator Author

teto commented Jun 13, 2023

@DanielSiepmann how does your module compare ? anything we could merge ?

And I can't migrate to upstream, due to still incomplete accounts modules.

what part do you miss, especially compared to yours ? Note that I messed up when merging. Does #4087 fix your situation ?

@DanielSiepmann
Copy link
Contributor

@teto I'm so newby that my module doesn't compare at all. I just did some small hacks: https://git.daniel-siepmann.de/danielsiepmann/nixpkgs/src/branch/main/home/modules/programs/vdirsyncer.nix (module) and https://git.daniel-siepmann.de/danielsiepmann/nixpkgs/src/branch/main/home/programs/vdirsyncer.nix (config).

Thanks @ncfavier. My own module has the same name, so I need to rename things or would disable my own as well? Renaming removes the need to disable the module anyway.

@ncfavier
Copy link
Member

disabledModules is supposed to look for relative paths in modulesPath, which is <home-manager/modules>, so your module should be left alone.

@teto
Copy link
Collaborator Author

teto commented Jun 13, 2023

you might be better off renaming your module, so you can try both.

@DanielSiepmann
Copy link
Contributor

@teto

Does #4087 fix your situation ?
I guess yes, as I end up in error: The option accounts.calendar' does not exist. Definition values`, will give it a try (later) and see whether I can migrate to the upstream :) And will provide feedback if I miss anything.

@ncfavier Thanks, it indeed works.

@Janik-Haag
Copy link
Member

@teto do you mind sharing your config I can't get it running in the current state ^^

my current config is this but the accounts module dosn't create a config for vdirsyncer.

{ ... }:
{
  services.vdirsyncer.enable = true;
  accounts.contact.basePath = ".con";
  accounts.calendar.basePath = ".cal";
  accounts.calendar.accounts.nerdberg = {
    khal = {
      enable = true;
      color = null;
      readOnly = true;
      type = "calendar";
    };
    local.type = "filesystem";
    local.fileExt = ".ics";
    name = "Nerdberg";
    remote = {
      type = "http";
      url = "https://kalender.nerdberg.de/events.ics";
    };
    vdirsyncer = {
      enable = true;
      collections = null;
      conflictResolution = "remote wins";
    };
  };
}

@Janik-Haag
Copy link
Member

also on another note: we have some stuff that is using local and other stuff locale which seems like it should be called the same every where, and I think there is a copy paste error:
image

@teto
Copy link
Collaborator Author

teto commented Jun 17, 2023

@Janik-Haag I would recommand first crafting a working configuration manually and once you have it working convert it to home-manager format so you can spot what is missing. My config is here https://github.com/teto/home/blob/main/hm/profiles/vdirsyncer.nix .

could you point in the code the typo ? I am not sure if you refer to locale as in LANG or LC_MONETARY variables

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/can-home-manager-install-unstable-and-stable-programs-modules-not-just-pkgs/42919/13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants