From f89427f939ae8c834f85e741c680cee25bcc4d3a Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Sat, 8 Jan 2022 18:52:30 +0100 Subject: [PATCH] tagtime: init at 2018-09-02 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original perl implementation of tagtime. I packaged it to the point of being able to use it on my system, in a very barebones state. The configuration is … well it just assumes you have a perl file somewhere and it evals it at startup. Since that configuration needs access to the distpath of tagtime, we just patch it a bit for now (which also means no user configuration is possible atm). The main changes to the config are: - instead of defaulting to `vim`, we use `$EDITOR` - The log file is placed in `$HOME/.local/share/tagtime/pings.log` (which corresponds to `$XDG_DATA_HOME` on normal unix systems), but could be patched to use the real logic instead. --- pkgs/applications/misc/tagtime/default.nix | 79 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 81 insertions(+) create mode 100644 pkgs/applications/misc/tagtime/default.nix diff --git a/pkgs/applications/misc/tagtime/default.nix b/pkgs/applications/misc/tagtime/default.nix new file mode 100644 index 000000000000..d21621058bca --- /dev/null +++ b/pkgs/applications/misc/tagtime/default.nix @@ -0,0 +1,79 @@ +{ lib, stdenv, fetchFromGitHub, perl, xterm, coreutils }: + +stdenv.mkDerivation { + pname = "tagtime"; + version = "2018-09-02"; + + src = fetchFromGitHub { + owner = "tagtime"; + repo = "TagTime"; + rev = "59343e2cbe451eb16109e782c194ccbd0ee4196d"; + sha256 = "1xpmra3f9618b0gajfxqh061r4phkiklvcgpglsyx82bhmgf9n1f"; + }; + + buildInputs = [ + perl + ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out/{libexec,bin} + + # We don’t support a config file for now, + # since it’s not entirely clear how to split nix-set paths + # from the actual config options. + for pl in *.pl; do + substituteInPlace "$pl" \ + --replace 'require "$ENV{HOME}/.tagtimerc";' \ + 'require "${placeholder "out"}/libexec/settings.pl";' + done; + + install tagtimed.pl $out/bin/tagtimed + + substituteInPlace util.pl \ + --replace '/usr/bin/touch' \ + '${coreutils}/bin/touch' \ + --replace '/bin/rm -f $lockf' \ + '${coreutils}/bin/rm -f $lockf' \ + --replace '$lockf = "''${path}tagtime.lock";' \ + 'mkdir "$ENV{HOME}/.cache/tagtime"; + $lockf = "$ENV{HOME}/.cache/tagtime/tagtime.lock";' + + mv *.pl $out/libexec/ + mv template.tsk $out/libexec/ + + + # set the default template arguments to sane defaults. + substitute settings.pl.template $out/libexec/settings.pl \ + --replace '"__USER__"' \ + 'getlogin()' \ + --replace '"__PATH__"' \ + '"${placeholder "out"}/libexec/"' \ + --replace '$logf = "$path$usr.log";' \ + 'mkdir "$ENV{HOME}/.local/share/tagtime"; + $logf = "$ENV{HOME}/.local/share/tagtime/pings.log";' \ + --replace '"__ED__ +"' \ + '$ENV{"EDITOR"}' \ + --replace '"__XT__"' \ + '"${xterm}/bin/xterm"' + + runHook postInstall + ''; + + meta = { + description = "Stochastic Time Tracking for Space Cadets"; + longDescription = '' + To determine how you spend your time, TagTime literally randomly samples + you. At random times it pops up and asks what you're doing right at that + moment. You answer with tags. + + See https://messymatters.com/tagtime for the whole story. + + [maintainer’s note]: This is the original perl script implementation. + ''; + homepage = "http://messymatters.com/tagtime/"; + license = lib.licenses.bsd3; + maintainers = [ lib.maintainers.Profpatsch ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e4a599c7c177..ad631f888467 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10048,6 +10048,8 @@ with pkgs; inherit (darwin.apple_sdk.frameworks) IOKit; }; + tagtime = callPackage ../applications/misc/tagtime { }; + inherit (callPackages ../applications/networking/taler { }) taler-exchange taler-merchant;