# Partially Override Timer Unit Configured by \`services.zfs.trim\`

**URL:** https://discourse.nixos.org/t/partially-override-timer-unit-configured-by-services-zfs-trim/35480
**Category:** Help
**Created:** [November 15, 2023, 7:03am UTC](https://discourse.nixos.org/t/partially-override-timer-unit-configured-by-services-zfs-trim/35480 "2023-11-15T07:03:50Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![scolby](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/s/bb73d2/32.png) [@scolby](https://discourse.nixos.org/u/scolby)
#### Post date: [November 15, 2023, 7:03am UTC](https://discourse.nixos.org/t/partially-override-timer-unit-configured-by-services-zfs-trim/35480/1 "2023-11-15T07:03:50Z")

</div>

I would like to add `RandomizedDelaySec = "7day"; FixedRandomizedDelay = "yes";` to the configuration of the `zfs-trim.timer` unit that is automatically produced by `services.zfs.trim.enabled = true;`. Here is what I have tried:

With this one, there was no evidence of my values:

```auto
  services.zfs.trim = {
    # I know these are default values,
    # just putting them here for illustration
    enable = true;
    interval = "weekly";
  };
  systemd.timers."zfs-trim" = {
    timerConfig = {
      RandomizedDelaySec = "7day";
      FixedRandomizedDelay = "yes";
    };
  };

```

With this one, the `nixos-rebuild` command hangs for a while and then gives up with stack overflow/possible infinite recursion:

```auto
  services.zfs.trim = {
    enable = true;
    interval = "weekly";
  };
  systemd.timers."zfs-trim" = lib.mkOverride {
    timerConfig = {
      RandomizedDelaySec = "7day";
      FixedRandomizedDelay = "yes";
    };
  };

```

With this one I get the error `error: anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:721:33 called with unexpected argument 'priority'` and with `--show-trace`, a huge stack trace that I have no idea how to interpret.

```auto
  services.zfs.trim = {
    enable = true;
    interval = "weekly";
  };
  systemd.timers."zfs-trim" = lib.mkAfter {
    timerConfig = {
      RandomizedDelaySec = "7day";
      FixedRandomizedDelay = "yes";
    };
  };

```

What is the right way to achieve what I seek here?

Thanks!

---

<div class="post-metadata">

### Author: ![NobbZ](https://discourse.nixos.org/user_avatar/discourse.nixos.org/nobbz/32/7022_2.png) [@NobbZ](https://discourse.nixos.org/u/NobbZ)
#### Post date: [November 15, 2023, 7:09am UTC](https://discourse.nixos.org/t/partially-override-timer-unit-configured-by-services-zfs-trim/35480/2 "2023-11-15T07:09:38Z")

</div>

The timer seems to be called `zpool-trim`, not `zfs-trim`.

> <https://github.com/NixOS/nixpkgs/blob/da4024d0ead5d7820f6bd15147d3fe2a0c0cec73/nixos/modules/tasks/filesystems/zfs.nix#L852-L866>

---

<div class="post-metadata">

### Author: ![scolby](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/s/bb73d2/32.png) [@scolby](https://discourse.nixos.org/u/scolby)
#### Post date: [November 15, 2023, 4:10pm UTC](https://discourse.nixos.org/t/partially-override-timer-unit-configured-by-services-zfs-trim/35480/3 "2023-11-15T16:10:54Z")

</div>

> [@NobbZ](#):
>
> The timer seems to be called `zpool-trim`, not `zfs-trim`.

🤦‍♂️ and that’s why I shouldn’t be trying to administer a system that late at night. Thanks!
