23 lines
700 B
Nix
23 lines
700 B
Nix
|
{ config, pkgs, contacts, addressbook, ... }:
|
||
|
|
||
|
let
|
||
|
shell = "${pkgs.dash}/bin/dash";
|
||
|
vdirsyncer = "${pkgs.vdirsyncer}/bin/vdirsyncer";
|
||
|
mkdir = "${pkgs.coreutils}/bin/mkdir";
|
||
|
cat = "${pkgs.coreutils}/bin/cat";
|
||
|
abook = "${pkgs.abook}/bin/abook";
|
||
|
dirname = "${pkgs.coreutils}/bin/dirname";
|
||
|
in
|
||
|
pkgs.writeScriptBin "davsync" ''
|
||
|
#!${shell}
|
||
|
${vdirsyncer} discover && \
|
||
|
${vdirsyncer} sync && \
|
||
|
${mkdir} -p "$(${dirname} ${addressbook})" && \
|
||
|
${cat} "${contacts}"/*/*/* | \
|
||
|
${abook} \
|
||
|
--convert \
|
||
|
--informat vcard \
|
||
|
--outformat abook > \
|
||
|
"${config.home.homeDirectory}/.abook/adressbook"
|
||
|
''
|