Skip to content

Conversation

@randywallace
Copy link

As a NixOS User, I drafted a quick flake so that I can include this project's app in my system. Perhaps this could be useful to other Nix users.

@00sapo
Copy link
Owner

00sapo commented Jul 2, 2025

How would it exactly work? Should I add it to the github repo?

@randywallace
Copy link
Author

You can if you'd like. I'm no expert in writing Nix flakes by any measure, so I'm using this project to learn as it isn't yet in nixpkgs, but the general gist is that once a project has a nix flake, you can do things like

  • use DevEnv to iterate faster in development (https://devenv.sh/)
  • use "nix develop" to run a local dev environment sandbox easily (with all the packages and dependencies and whatnot)
  • just run taskcheck quickly (doesn't handle configs and whatnot, but runs the binary) like this:
❯ nix run github:randywallace/taskcheck/feat/nix-flake -- --help
usage: taskcheck [-h] [-v] [-i] [-r REPORT] [-s] [-f] [--taskrc TASKRC] [--urgency-weight URGENCY_WEIGHT] [--dry-run] [--no-auto-adjust-urgency]

options:
  -h, --help            show this help message and exit
  -v, --verbose         Increase output verbosity.
  -i, --install         Install the UDAs, required settings, and default config file.
  -r, --report REPORT   Generate a report of the tasks based on the scheduling; can be any Taskwarrior datetime specification (e.g. today, tomorrow, eom, som, 1st, 2nd, etc.). It is considered as `by`, meaning that the
                        report will be generated for all the days until the specified date and including it.
  -s, --schedule        Perform the scheduling algorithm, giving a schedule and a scheduling UDA and alerting for not completable tasks.
  -f, --force-update    Force update of all ical calendars by ignoring cache expiration.
  --taskrc TASKRC       Set custom TASKRC directory for debugging purposes.
  --urgency-weight URGENCY_WEIGHT
                        Weight for urgency in scheduling (0.0 to 1.0), overrides config value. When 1.0, the whole Taskwarrior urgency is used for scheduling. When 0.0, the Taskwarrior urgency is reduced to only due
                        urgency.
  --dry-run             Perform scheduling without modifying the Taskwarrior database, useful for testing.
  --no-auto-adjust-urgency
                        Disable automatic reduction of urgency weight when tasks cannot be completed on time. (Enabled by default, meaning automatic reduction will occur.)
  • install this app in your own NixOS Home Manager configuration and set it up to your liking (see an example NixOS config in the checks.x86_64-linux section toward the bottom). Someone using Home Manager could install this is as simply as this, which handles setting up configs, installing taskwarrior, et al.:
programs.taskcheck = {
  enable = true;
  optional_hm_config = true;
};
  • use nix flake check -L -v at the root of this project to do a kind of integration test, as the check I wrote sets up taskcheck in a Virtual Machine sandbox, installs it, and runs some rudimentary tasks, in an remarkably idempotent and repeatable manner.

@00sapo
Copy link
Owner

00sapo commented Jul 3, 2025

Ok. I don't think I will ever use Nix (I tried it in the past and it's just not in my taste). Please, when you feel that the PR is finished, update this thread and I will merge it.

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.

2 participants