From 123f53cf91cd9c82e768398825fcc169f5756261 Mon Sep 17 00:00:00 2001 From: Zuckerberg Date: Fri, 20 Feb 2026 22:01:20 -0800 Subject: [PATCH] Speed up attic --- common/server/atticd.nix | 52 +++++++++++++++---- .../storage/s0/hardware-configuration.nix | 8 ++- 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/common/server/atticd.nix b/common/server/atticd.nix index 9aefc5a..2f81ad9 100644 --- a/common/server/atticd.nix +++ b/common/server/atticd.nix @@ -7,25 +7,55 @@ environmentFile = config.age.secrets.atticd-credentials.path; settings = { listen = "[::]:28338"; + database.url = "postgresql:///atticd?host=/run/postgresql"; + require-proof-of-possession = false; + # Disable chunking — the dedup savings don't justify the CPU/IO + # overhead for local storage, especially on ZFS which already + # does block-level compression. chunking = { - nar-size-threshold = 64 * 1024; # 64 KiB - - # The preferred minimum size of a chunk, in bytes - min-size = 16 * 1024; # 16 KiB - - # The preferred average size of a chunk, in bytes - avg-size = 64 * 1024; # 64 KiB - - # The preferred maximum size of a chunk, in bytes - max-size = 256 * 1024; # 256 KiB + nar-size-threshold = 0; + min-size = 16 * 1024; + avg-size = 64 * 1024; + max-size = 256 * 1024; }; - compression.type = "zstd"; + # Let ZFS handle compression instead of double-compressing. + compression.type = "none"; + garbage-collection.default-retention-period = "6 months"; }; }; + # PostgreSQL for atticd + services.postgresql = { + enable = true; + ensureDatabases = [ "atticd" ]; + ensureUsers = [{ + name = "atticd"; + ensureDBOwnership = true; + }]; + }; + + # Use a static user so the ZFS mountpoint at /var/lib/atticd works + # (DynamicUser conflicts with ZFS mountpoints) + users.users.atticd = { + isSystemUser = true; + group = "atticd"; + home = "/var/lib/atticd"; + }; + users.groups.atticd = { }; + + systemd.services.atticd = { + after = [ "postgresql.service" ]; + requires = [ "postgresql.service" ]; + serviceConfig = { + DynamicUser = lib.mkForce false; + User = "atticd"; + Group = "atticd"; + }; + }; + age.secrets.atticd-credentials.file = ../../secrets/atticd-credentials.age; }; } diff --git a/machines/storage/s0/hardware-configuration.nix b/machines/storage/s0/hardware-configuration.nix index 686af06..8811a9e 100644 --- a/machines/storage/s0/hardware-configuration.nix +++ b/machines/storage/s0/hardware-configuration.nix @@ -45,6 +45,12 @@ fsType = "zfs"; options = [ "zfsutil" "X-mount.mkdir" ]; }; + fileSystems."/var/lib/atticd" = + { + device = "rpool/nixos/var/lib/atticd"; + fsType = "zfs"; + options = [ "zfsutil" "X-mount.mkdir" ]; + }; fileSystems."/var/log" = { device = "rpool/nixos/var/log"; @@ -72,5 +78,5 @@ }; }; - powerManagement.cpuFreqGovernor = "powersave"; + powerManagement.cpuFreqGovernor = "schedutil"; }