Merge pull request #318892 from doronbehar/pkg/taskwarrior3

nixosTests.taskchampion-sync-server: init
This commit is contained in:
Doron Behar 2024-08-14 19:43:33 +00:00 committed by GitHub
commit 6bfd71d2b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 244 additions and 63 deletions

View File

@ -27,6 +27,8 @@
## New Services {#sec-release-24.11-new-services}
- [TaskChampion Sync-Server](https://github.com/GothenburgBitFactory/taskchampion-sync-server), a [Taskwariror 3](https://taskwarrior.org/docs/upgrade-3/) sync server, replacing Taskwarrior 2's sync server named [`taskserver`](https://github.com/GothenburgBitFactory/taskserver).
- [FlareSolverr](https://github.com/FlareSolverr/FlareSolverr), proxy server to bypass Cloudflare protection. Available as [services.flaresolverr](#opt-services.flaresolverr.enable) service.
- [Goatcounter](https://www.goatcounter.com/), Easy web analytics. No tracking of personal data. Available as [services.goatcounter](options.html#opt-services.goatcocunter.enable).

View File

@ -846,6 +846,7 @@
./services/misc/tabby.nix
./services/misc/tandoor-recipes.nix
./services/misc/taskserver
./services/misc/taskchampion-sync-server.nix
./services/misc/tautulli.nix
./services/misc/tiddlywiki.nix
./services/misc/tp-auto-kbbl.nix

View File

@ -0,0 +1,85 @@
{
config,
pkgs,
lib,
...
}:
let
inherit (lib) types;
cfg = config.services.taskchampion-sync-server;
in
{
options.services.taskchampion-sync-server = {
enable = lib.mkEnableOption "TaskChampion Sync Server for Taskwarrior 3";
package = lib.mkPackageOption pkgs "taskchampion-sync-server" { };
user = lib.mkOption {
description = "Unix User to run the server under";
type = types.str;
default = "taskchampion";
};
group = lib.mkOption {
description = "Unix Group to run the server under";
type = types.str;
default = "taskchampion";
};
port = lib.mkOption {
description = "Port on which to serve";
type = types.port;
default = 10222;
};
openFirewall = lib.mkEnableOption "Open firewall port for taskchampion-sync-server";
dataDir = lib.mkOption {
description = "Directory in which to store data";
type = types.path;
default = "/var/lib/taskchampion-sync-server";
};
snapshot = {
versions = lib.mkOption {
description = "Target number of versions between snapshots";
type = types.ints.positive;
default = 100;
};
days = lib.mkOption {
description = "Target number of days between snapshots";
type = types.ints.positive;
default = 14;
};
};
};
config = lib.mkIf cfg.enable {
users.users.${cfg.user} = {
isSystemUser = true;
inherit (cfg) group;
};
users.groups.${cfg.group} = { };
networking.firewall.allowedTCPPorts = lib.mkIf (cfg.openFirewall) [ cfg.port ];
systemd.tmpfiles.settings = {
"10-taskchampion-sync-server" = {
"${cfg.dataDir}" = {
d = {
inherit (cfg) group user;
mode = "0750";
};
};
};
};
systemd.services.taskchampion-sync-server = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
User = cfg.user;
Group = cfg.group;
DynamicUser = false;
ExecStart = ''
${lib.getExe cfg.package} \
--port ${builtins.toString cfg.port} \
--data-dir ${cfg.dataDir} \
--snapshot-versions ${builtins.toString cfg.snapshot.versions} \
--snapshot-days ${builtins.toString cfg.snapshot.days}
'';
};
};
};
}

View File

@ -1,10 +1,18 @@
# Taskserver {#module-services-taskserver}
Taskserver is the server component of
Taskserver is the server component of the now deprecated version 2 of
[Taskwarrior](https://taskwarrior.org/), a free and
open source todo list application.
*Upstream documentation:* <https://taskwarrior.org/docs/#taskd>
[Taskwarrior 3.0.0 was released in March
2024](https://github.com/GothenburgBitFactory/taskwarrior/releases/tag/v3.0.0),
and the sync functionality was rewritten entirely. With it, a NixOS module
named
[`taskchampion-sync-server`](options.html#opt-services.taskchampion-sync-server.enable)
was added to Nixpkgs. Many people still want to use the old [Taskwarrior
2.6.x](https://github.com/GothenburgBitFactory/taskwarrior/releases/tag/v2.6.2),
and Taskserver along with it. Hence this module and this documentation will
stay here for the near future.
## Configuration {#module-services-taskserver-configuration}
@ -23,7 +31,7 @@ entity.
With {command}`nixos-taskserver` the client certificate is created
along with the UUID of the user, so it handles all of the credentials needed
in order to setup the Taskwarrior client to work with a Taskserver.
in order to setup the Taskwarrior 2 client to work with a Taskserver.
## The nixos-taskserver tool {#module-services-taskserver-nixos-taskserver-tool}
@ -49,7 +57,7 @@ command, documentation for each subcommand can be shown by using the
## Declarative/automatic CA management {#module-services-taskserver-declarative-ca-management}
Everything is done according to what you specify in the module options,
however in order to set up a Taskwarrior client for synchronisation with a
however in order to set up a Taskwarrior 2 client for synchronisation with a
Taskserver instance, you have to transfer the keys and certificates to the
client machine.

View File

@ -143,7 +143,7 @@ in {
description = let
url = "https://nixos.org/manual/nixos/stable/index.html#module-services-taskserver";
in ''
Whether to enable the Taskwarrior server.
Whether to enable the Taskwarrior 2 server.
More instructions about NixOS in conjunction with Taskserver can be
found [in the NixOS manual](${url}).
@ -327,7 +327,7 @@ in {
Configuration options to pass to Taskserver.
The options here are the same as described in
{manpage}`taskdrc(5)`, but with one difference:
{manpage}`taskdrc(5)` from the `taskwarrior2` package, but with one difference:
The `server` option is
`server.listen` here, because the
@ -449,7 +449,7 @@ in {
};
systemd.services.taskserver = {
description = "Taskwarrior Server";
description = "Taskwarrior 2 Server";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];

View File

@ -996,6 +996,7 @@ in {
tandoor-recipes-script-name = handleTest ./tandoor-recipes-script-name.nix {};
tang = handleTest ./tang.nix {};
taskserver = handleTest ./taskserver.nix {};
taskchampion-sync-server = handleTest ./taskchampion-sync-server.nix {};
tayga = handleTest ./tayga.nix {};
technitium-dns-server = handleTest ./technitium-dns-server.nix {};
teeworlds = handleTest ./teeworlds.nix {};

View File

@ -0,0 +1,48 @@
import ./make-test-python.nix (
{ ... }:
{
name = "taskchampion-sync-server";
nodes = {
server = {
services.taskchampion-sync-server.enable = true;
services.taskchampion-sync-server.openFirewall = true;
};
client =
{ pkgs, ... }:
{
environment.systemPackages = [ pkgs.taskwarrior3 ];
};
};
testScript =
{ nodes, ... }:
let
cfg = nodes.server.services.taskchampion-sync-server;
port = builtins.toString cfg.port;
# Generated with uuidgen
uuid = "bf01376e-04a4-435a-9263-608567531af3";
password = "nixos-test";
in
''
# Explicitly start the VMs so that we don't accidentally start newServer
server.start()
client.start()
server.wait_for_unit("taskchampion-sync-server.service")
server.wait_for_open_port(${port})
# See man task-sync(5)
client.succeed("mkdir ~/.task")
client.succeed("touch ~/.taskrc")
client.succeed("echo sync.server.origin=http://server:${port} >> ~/.taskrc")
client.succeed("echo sync.server.client_id=${uuid} >> ~/.taskrc")
client.succeed("echo sync.encryption_secret=${password} >> ~/.taskrc")
client.succeed("task add hello world")
client.succeed("task sync")
# Useful for debugging
client.copy_from_vm("/root/.task", "client")
server.copy_from_vm("${cfg.dataDir}", "server")
'';
}
)

View File

@ -81,7 +81,7 @@ in {
};
client1 = { pkgs, ... }: {
environment.systemPackages = [ pkgs.taskwarrior pkgs.gnutls ];
environment.systemPackages = [ pkgs.taskwarrior2 pkgs.gnutls ];
users.users.alice.isNormalUser = true;
users.users.bob.isNormalUser = true;
users.users.foo.isNormalUser = true;

View File

@ -7,6 +7,10 @@
"date": "2021-12-21",
"new": "cmp-tmux"
},
"taskwarrior": {
"date": "2024-08-13",
"new": "taskwarrior3 or taskwarrior2"
},
"fern-vim": {
"date": "2024-05-28",
"new": "vim-fern"

View File

@ -46,7 +46,8 @@
, statix
, stylish-haskell
, tabnine
, taskwarrior
, taskwarrior2
, taskwarrior3
, tmux
, tup
, vim
@ -1581,9 +1582,14 @@
};
};
taskwarrior = buildVimPlugin {
inherit (taskwarrior) version pname;
src = "${taskwarrior.src}/scripts/vim";
taskwarrior3 = buildVimPlugin {
inherit (taskwarrior3) version pname;
src = "${taskwarrior3.src}/scripts/vim";
};
taskwarrior2 = buildVimPlugin {
inherit (taskwarrior2) version pname;
src = "${taskwarrior2.src}/scripts/vim";
};
telescope-cheat-nvim = super.telescope-cheat-nvim.overrideAttrs {

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, pkg-config, makeWrapper, gtk3, json_c, taskwarrior }:
{ lib, stdenv, fetchurl, pkg-config, makeWrapper, gtk3, json_c, taskwarrior2 }:
stdenv.mkDerivation rec {
pname = "ptask";
@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
preFixup = ''
wrapProgram "$out/bin/ptask" \
--prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \
--prefix PATH : "${taskwarrior}/bin"
--prefix PATH : "${taskwarrior2}/bin"
'';
meta = with lib; {

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, fetchpatch, makeWrapper, perl, ncurses5, taskwarrior }:
{ lib, stdenv, fetchFromGitHub, fetchpatch, makeWrapper, perl, ncurses5, taskwarrior2 }:
stdenv.mkDerivation rec {
version = "2020-12-17";
@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
DESTDIR=$out PREFIX= MANPREFIX=/share/man make install
wrapProgram $out/bin/tasknc --prefix PATH : ${taskwarrior}/bin
wrapProgram $out/bin/tasknc --prefix PATH : ${taskwarrior2}/bin
'';

View File

@ -1,7 +1,7 @@
{ lib
, python3Packages
, fetchPypi
, taskwarrior
, taskwarrior2
, glibcLocales
}:
@ -24,7 +24,7 @@ buildPythonApplication rec {
nativeCheckInputs = [ glibcLocales ];
makeWrapperArgs = [ "--suffix" "PATH" ":" "${taskwarrior}/bin" ];
makeWrapperArgs = [ "--suffix" "PATH" ":" "${taskwarrior2}/bin" ];
preCheck = ''
export TERM=''${TERM-linux}

View File

@ -1,4 +1,14 @@
{ lib, stdenv, fetchFromGitHub, cmake, libuuid, gnutls, python3, xdg-utils, installShellFiles }:
{
lib,
stdenv,
fetchFromGitHub,
cmake,
libuuid,
gnutls,
python3,
xdg-utils,
installShellFiles,
}:
stdenv.mkDerivation rec {
pname = "taskwarrior";
@ -17,7 +27,13 @@ stdenv.mkDerivation rec {
--replace "xdg-open" "${lib.getBin xdg-utils}/bin/xdg-open"
'';
nativeBuildInputs = [ cmake libuuid gnutls python3 installShellFiles ];
nativeBuildInputs = [
cmake
libuuid
gnutls
python3
installShellFiles
];
doCheck = true;
preCheck = ''
@ -44,7 +60,10 @@ stdenv.mkDerivation rec {
description = "Highly flexible command-line tool to manage TODO lists";
homepage = "https://taskwarrior.org";
license = licenses.mit;
maintainers = with maintainers; [ marcweber oxalica ];
maintainers = with maintainers; [
marcweber
oxalica
];
mainProgram = "task";
platforms = platforms.unix;
};

View File

@ -8,6 +8,7 @@
fetchFromGitHub,
cmake,
libuuid,
nixosTests,
python3,
xdg-utils,
installShellFiles,
@ -29,20 +30,22 @@ stdenv.mkDerivation rec {
--replace "xdg-open" "${lib.getBin xdg-utils}/bin/xdg-open"
'';
nativeBuildInputs = [
cmake
libuuid
python3
installShellFiles
corrosion
cargo
rustc
rustPlatform.cargoSetupHook
] ++ lib.optionals stdenv.isDarwin [
# darwin dependencies
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration
];
nativeBuildInputs =
[
cmake
libuuid
python3
installShellFiles
corrosion
cargo
rustc
rustPlatform.cargoSetupHook
]
++ lib.optionals stdenv.isDarwin [
# darwin dependencies
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration
];
doCheck = true;
checkTarget = "build_tests";
@ -73,13 +76,20 @@ stdenv.mkDerivation rec {
ln -s $out/share/vim-plugins/task $out/share/nvim/site
'';
meta = with lib; {
passthru.tests.nixos = nixosTests.taskchampion-sync-server;
meta = {
changelog = "https://github.com/GothenburgBitFactory/taskwarrior/blob/${src.rev}/ChangeLog";
description = "Highly flexible command-line tool to manage TODO lists";
homepage = "https://taskwarrior.org";
license = licenses.mit;
maintainers = with maintainers; [marcweber oxalica mlaradji];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
marcweber
oxalica
mlaradji
doronbehar
];
mainProgram = "task";
platforms = platforms.unix;
platforms = lib.platforms.unix;
};
}

View File

@ -1,4 +1,4 @@
{ lib, stdenv, substituteAll, fetchFromGitHub, taskwarrior, gettext, runtimeShell }:
{ lib, stdenv, substituteAll, fetchFromGitHub, taskwarrior2, gettext, runtimeShell }:
stdenv.mkDerivation rec {
pname = "gnome-shell-extension-taskwhisperer";
@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
];
buildInputs = [
taskwarrior
taskwarrior2
];
passthru = {
@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
patches = [
(substituteAll {
src = ./fix-paths.patch;
task = "${taskwarrior}/bin/task";
task = "${taskwarrior2}/bin/task";
shell = runtimeShell;
})
];

View File

@ -1,17 +1,14 @@
{
lib,
pythonPackages,
buildPythonPackage,
six,
pytz,
tzlocal,
fetchPypi,
taskwarrior,
taskwarrior2,
writeShellScriptBin,
}:
with pythonPackages;
let
wsl_stub = writeShellScriptBin "wsl" "true";
in
buildPythonPackage rec {
pname = "tasklib";
version = "2.5.1";
@ -29,16 +26,17 @@ buildPythonPackage rec {
];
nativeCheckInputs = [
taskwarrior
wsl_stub
taskwarrior2
# stub
(writeShellScriptBin "wsl" "true")
];
meta = with lib; {
meta = {
homepage = "https://github.com/robgolding/tasklib";
description = "Library for interacting with taskwarrior databases";
changelog = "https://github.com/GothenburgBitFactory/tasklib/releases/tag/${version}";
maintainers = with maintainers; [ arcnmx ];
platforms = platforms.all;
license = licenses.bsd3;
maintainers = with lib.maintainers; [ arcnmx ];
platforms = lib.platforms.all;
license = lib.licenses.bsd3;
};
}

View File

@ -9,7 +9,7 @@
python-dateutil,
pythonOlder,
pytz,
taskwarrior,
taskwarrior2,
}:
buildPythonPackage rec {
@ -44,7 +44,7 @@ buildPythonPackage rec {
pytz
];
checkInputs = [ taskwarrior ];
checkInputs = [ taskwarrior2 ];
# TODO: doesn't pass because `can_use` fails and `task --version` seems not to be answering.
# pythonImportsCheck = [ "taskw_ng" ];

View File

@ -8,7 +8,7 @@
setuptools,
# native dependencies
pkgs,
taskwarrior2,
# dependencies
kitchen,
@ -39,12 +39,12 @@ buildPythonPackage rec {
];
postPatch = ''
substituteInPlace taskw/warrior.py \
--replace '@@taskwarrior@@' '${pkgs.taskwarrior}'
--replace '@@taskwarrior@@' '${taskwarrior2}'
'';
build-system = [ setuptools ];
buildInputs = [ pkgs.taskwarrior ];
buildInputs = [ taskwarrior2 ];
dependencies = [
kitchen

View File

@ -1432,6 +1432,7 @@ mapAliases ({
tabula = throw "tabula has been removed from nixpkgs, as it was broken"; # Added 2024-07-15
tangogps = foxtrotgps; # Added 2020-01-26
taskwarrior = lib.warn "taskwarrior was replaced by taskwarrior3, which requires manual transition from taskwarrior 2.6, read upstram's docs: https://taskwarrior.org/docs/upgrade-3/" taskwarrior2;
taplo-cli = taplo; # Added 2022-07-30
taplo-lsp = taplo; # Added 2022-07-30
taro = taproot-assets; # Added 2023-07-04

View File

@ -33840,8 +33840,6 @@ with pkgs;
tasktimer = callPackage ../applications/misc/tasktimer { };
taskwarrior = callPackage ../applications/misc/taskwarrior { };
taskwarrior-tui = callPackage ../applications/misc/taskwarrior-tui { };
dstask = callPackage ../applications/misc/dstask { };