1
Fork 0
mirror of https://github.com/benkoppe/tmignore synced 2026-09-19 14:59:52 -07:00
No description
  • Rust 85.2%
  • Nix 14.8%
Find a file
2026-07-05 13:24:42 -07:00
nix nix: add explicit tmignore command option 2026-07-05 13:24:42 -07:00
src nix: add explicit tmignore command option 2026-07-05 13:24:42 -07:00
tests global: rename extra targets and allow VM paths 2026-07-05 12:42:38 -07:00
.envrc nix: create flake 2026-07-03 23:28:36 -07:00
.gitignore nix: create flake 2026-07-03 23:28:36 -07:00
AGENTS.md global: rename extra targets and allow VM paths 2026-07-05 12:42:38 -07:00
Cargo.lock config: load figment toml configuration 2026-07-04 22:14:55 -07:00
Cargo.toml core: fix default rules, tmutil codes, and exit codes 2026-07-05 01:47:05 -07:00
CONFIGURATION.md nix: add explicit tmignore command option 2026-07-05 13:24:42 -07:00
deny.toml nix: create flake 2026-07-03 23:28:36 -07:00
flake.lock nix: add darwin launchd module 2026-07-04 22:50:03 -07:00
flake.nix nix: add darwin launchd module 2026-07-04 22:50:03 -07:00
GUIDELINES.md docs: add GUIDELINES.md 2026-07-03 21:22:43 -07:00
opencode.json docs: add opencode.json with references 2026-07-03 21:24:44 -07:00
README.md nix: add explicit tmignore command option 2026-07-05 13:24:42 -07:00

tmignore

tmignore finds restoreable development dependency/cache directories and excludes them from Time Machine backups.

The project is intended for declarative nix-darwin use. By default, the nix-darwin module runs in dry-run mode and does not change Time Machine exclusions.

nix-darwin

Import the module from the flake and enable the service:

{
  inputs.tmignore.url = "github:benkoppe/tmignore";

  outputs = { self, nix-darwin, tmignore, ... }: {
    darwinConfigurations.example = nix-darwin.lib.darwinSystem {
      modules = [
        tmignore.darwinModules.default
        ({ config, ... }:
        let
          home = config.users.users.alice.home;
        in
        {
          services.tmignore = {
            enable = true;
            scan.roots = [ "${home}/Developer" ];
          };
        })
      ];
    };
  };
}

See CONFIGURATION.md for the full nix-darwin module and TOML config reference.

The default schedule is daily at 03:30 local time:

services.tmignore.schedule = [
  { Hour = 3; Minute = 30; }
];

To run multiple times per day, add more entries:

services.tmignore.schedule = [
  { Hour = 9; Minute = 0; }
  { Hour = 17; Minute = 0; }
];

To apply Time Machine exclusions, opt in explicitly:

services.tmignore.mode = "apply";

The launchd job runs tmignore all by default, which combines project scanning with global dependency/cache directory exclusions. To choose a different scheduled command:

services.tmignore.command = "scan";

For global cache targets only:

services.tmignore.command = "global";

For laptops, runAtLoad can catch cases where the machine was asleep or off during a scheduled time:

services.tmignore.runAtLoad = true;

Extra Rules

Named extra scan rules are generated as scan.extra_rules.<name> in the TOML config:

services.tmignore.scan.extraRules.pnpm_store = {
  cases = [
    {
      targets = [
        { path = ".pnpm-store"; kind = "directory"; }
      ];
      requirements = [
        {
          any_of = [
            { path = "package.json"; kind = "file"; base = "candidate_parent"; }
          ];
        }
      ];
    }
  ];
};

Extra global cache targets are fixed paths under known cache namespaces, resolved relative to the user's home directory:

services.tmignore.global.extraTargets.custom_cache.path = ".cargo/registry/custom";

Manual CLI usage is split into explicit commands:

tmignore scan --root ~/Developer
tmignore global
tmignore all --root ~/Developer