bring back attic. this time with garage backend

This commit is contained in:
cy 2025-03-13 13:25:28 -04:00
parent f4f0691647
commit f4c7243b69
Signed by: cy
SSH key fingerprint: SHA256:o/geVWV4om1QhUSkKvDQeW/eAihwnjyXkqMwrVdbuts
10 changed files with 107 additions and 183 deletions

159
flake.lock generated
View file

@ -2,12 +2,22 @@
"nodes": {
"attic": {
"inputs": {
"crane": "crane",
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"crane": [
"crane"
],
"flake-compat": [
"flake-compat"
],
"flake-parts": [
"flake-parts"
],
"nix-github-actions": "nix-github-actions",
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable"
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": [
"nixpkgs-stable"
]
},
"locked": {
"lastModified": 1738524606,
@ -19,7 +29,6 @@
},
"original": {
"owner": "zhaofengli",
"ref": "main",
"repo": "attic",
"type": "github"
}
@ -27,9 +36,9 @@
"cachix": {
"inputs": {
"devenv": "devenv",
"flake-compat": "flake-compat_2",
"flake-compat": "flake-compat",
"git-hooks": "git-hooks",
"nixpkgs": "nixpkgs_4"
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1737621947,
@ -63,7 +72,7 @@
"cachix",
"devenv"
],
"nixpkgs": "nixpkgs_2"
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1728672398,
@ -99,7 +108,9 @@
},
"conduwuit": {
"inputs": {
"attic": "attic",
"attic": [
"attic"
],
"cachix": "cachix",
"complement": "complement",
"crane": [
@ -134,28 +145,6 @@
}
},
"crane": {
"inputs": {
"nixpkgs": [
"conduwuit",
"attic",
"nixpkgs"
]
},
"locked": {
"lastModified": 1722960479,
"narHash": "sha256-NhCkJJQhD5GUib8zN9JrmYGMwt4lCRp6ZVNzIiYCl0Y=",
"owner": "ipetkov",
"repo": "crane",
"rev": "4c6c77920b8d44cd6660c1621dea6b3fc4b4c4f4",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"crane_2": {
"locked": {
"lastModified": 1741481578,
"narHash": "sha256-JBTSyJFQdO3V8cgcL08VaBUByEU6P5kXbTJN6R0PFQo=",
@ -228,22 +217,6 @@
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1733328505,
@ -259,7 +232,7 @@
"type": "github"
}
},
"flake-compat_3": {
"flake-compat_2": {
"locked": {
"lastModified": 1733328505,
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
@ -275,28 +248,6 @@
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"conduwuit",
"attic",
"nixpkgs"
]
},
"locked": {
"lastModified": 1722555600,
"narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "8471fe90ad337a8074e957b69ca4d0089218391d",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"conduwuit",
@ -320,7 +271,7 @@
"type": "github"
}
},
"flake-parts_3": {
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs"
@ -404,7 +355,7 @@
"cachix",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable_2"
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1733318908,
@ -666,9 +617,9 @@
"cachix",
"devenv"
],
"flake-parts": "flake-parts_2",
"flake-parts": "flake-parts",
"libgit2": "libgit2",
"nixpkgs": "nixpkgs_3",
"nixpkgs": "nixpkgs_2",
"nixpkgs-23-11": [
"conduwuit",
"cachix",
@ -719,7 +670,6 @@
"nix-github-actions": {
"inputs": {
"nixpkgs": [
"conduwuit",
"attic",
"nixpkgs"
]
@ -796,16 +746,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1726042813,
"narHash": "sha256-LnNKCCxnwgF+575y0pxUdlGZBO/ru1CtGHIqQVfvjlA=",
"lastModified": 1730531603,
"narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "159be5db480d1df880a0135ca0bfed84c2f88353",
"rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -827,22 +777,6 @@
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1724316499,
"narHash": "sha256-Qb9MhKBUTCfWg/wqqaxt89Xfi6qTD3XpTzQ9eXi3JmE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "797f7dc49e0bc7fab4b57c021cdf68f595e47841",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1730741070,
"narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=",
@ -858,7 +792,7 @@
"type": "github"
}
},
"nixpkgs-stable_3": {
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1741600792,
"narHash": "sha256-yfDy6chHcM7pXpMF4wycuuV+ILSTG486Z/vLx/Bdi6Y=",
@ -875,22 +809,6 @@
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1730531603,
"narHash": "sha256-Dqg6si5CqIzm87sp57j5nTaeBbWhHFaVyG7V6L8k3lY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7ffd9ae656aec493492b44d0ddfb28e79a1ea25d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1717432640,
"narHash": "sha256-+f9c4/ZX5MWDOuB1rKoWj+lBNm0z0rs4CK47HBLxy1o=",
@ -906,7 +824,7 @@
"type": "github"
}
},
"nixpkgs_4": {
"nixpkgs_3": {
"locked": {
"lastModified": 1733212471,
"narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=",
@ -922,7 +840,7 @@
"type": "github"
}
},
"nixpkgs_5": {
"nixpkgs_4": {
"locked": {
"lastModified": 1741692589,
"narHash": "sha256-t1BrOTAUIkRY4YlSspERzz5iaFbzJTIE6mhLmnWrDaA=",
@ -1078,10 +996,11 @@
},
"root": {
"inputs": {
"attic": "attic",
"conduwuit": "conduwuit",
"crane": "crane_2",
"flake-compat": "flake-compat_3",
"flake-parts": "flake-parts_3",
"crane": "crane",
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts_2",
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"lanzaboote": "lanzaboote",
@ -1090,8 +1009,8 @@
"nil": "nil",
"nix-index-database": "nix-index-database",
"nix-ld": "nix-ld",
"nixpkgs": "nixpkgs_5",
"nixpkgs-stable": "nixpkgs-stable_3",
"nixpkgs": "nixpkgs_4",
"nixpkgs-stable": "nixpkgs-stable_2",
"nixvim": "nixvim",
"nvim-github-theme": "nvim-github-theme",
"pixelflasher": "pixelflasher",

View file

@ -44,6 +44,7 @@
crane.follows = "crane";
flake-compat.follows = "flake-compat";
flake-utils.follows = "flake-utils";
attic.follows = "attic";
};
};
lix-module = {
@ -77,6 +78,16 @@
inputs.nixpkgs.follows = "nixpkgs";
};
pixelflasher.url = "github:cything/nixpkgs/pixelflasher";
attic = {
url = "github:zhaofengli/attic";
inputs = {
nixpkgs.follows = "nixpkgs";
nixpkgs-stable.follows = "nixpkgs-stable";
flake-compat.follows = "flake-compat";
flake-parts.follows = "flake-parts";
crane.follows = "crane";
};
};
nvim-github-theme = {
url = "github:projekt0n/github-nvim-theme";

View file

@ -200,4 +200,5 @@
my.roundcube.enable = true;
my.zipline.enable = true;
my.searx.enable = true;
my.attic.enable = true;
}

View file

@ -22,23 +22,6 @@
};
};
systemd.services.attic-mount = {
enable = true;
description = "Mount the attic data remote";
requires = [ "network-online.target" ];
after = [ "network-online.target" ];
requiredBy = [ "atticd.service" ];
before = [ "atticd.service" ];
serviceConfig = {
Type = "notify";
ExecStartPre = "/usr/bin/env mkdir -p /mnt/attic";
ExecStart = "${lib.getExe pkgs.rclone} mount --config ${
config.sops.secrets."rclone/config".path
} --cache-dir /var/cache/rclone --transfers=32 --checkers=32 --vfs-cache-mode writes --vfs-cache-max-size 2G --allow-other rsyncnet:attic /mnt/attic ";
ExecStop = "${lib.getExe' pkgs.fuse "fusermount"} -u /mnt/attic";
};
};
systemd.services.garage-mount = {
enable = true;
description = "Mount the garage data remote";

47
modules/attic.nix Normal file
View file

@ -0,0 +1,47 @@
{
config,
lib,
...
}:
let
cfg = config.my.attic;
in
{
options.my.attic = {
enable = lib.mkEnableOption "attic";
};
config = lib.mkIf cfg.enable {
services.atticd = {
enable = true;
environmentFile = config.sops.secrets."attic/env".path;
settings = {
listen = "[::]:8091";
api-endpoint = "https://cache.cy7.sh/";
allowed-hosts = [ "cache.cy7.sh" ];
require-proof-of-possession = false;
compression = {
type = "zstd";
level = 3;
};
database.url = "postgresql:///atticd?host=/run/postgresql";
storage = {
type = "s3";
region = "us-east-1";
bucket = "attic";
endpoint = "https://s3.cy7.sh";
};
garbage-collection = {
default-retention-period = "1 month";
};
};
};
services.caddy.virtualHosts."cache.cy7.sh".extraConfig = ''
import common
reverse_proxy localhost:8091
'';
};
}

View file

@ -8,5 +8,6 @@
./containerization.nix
./vaultwarden.nix
./searx.nix
./attic.nix
];
}

View file

@ -1,13 +0,0 @@
diff --git a/server/src/config.rs b/server/src/config.rs
index 4412cbf..6dd483a 100644
--- a/server/src/config.rs
+++ b/server/src/config.rs
@@ -565,7 +565,7 @@ fn default_default_retention_period() -> Duration {
}
fn default_concurrent_chunk_uploads() -> usize {
- 10
+ 32
}
fn load_config_from_path(path: &Path) -> Result<Config> {

View file

@ -1,26 +0,0 @@
final: prev: {
attic-client = prev.attic-client.override (old: {
rustPlatform = old.rustPlatform // {
buildRustPackage =
args:
old.rustPlatform.buildRustPackage (
args
// {
version = "0.1.1";
src = final.fetchFromGitHub {
owner = "cything";
repo = "attic";
rev = "d660c85bdb6bb10499a23a846a13107ea0c72769";
hash = "sha256-E22d2OLV02L2QdiSeK58flveehR8z8WIKkcN/njAMdg=";
};
cargoLock = null;
cargoHash = "sha256-AbpWnYfBMrR6oOfy2LkQvIPYsClCWE89bJav+iHTtLM=";
useFetchCargoVendor = true;
patches = [
./concurrent-32.patch
];
}
);
};
});
}

View file

@ -1,14 +1,12 @@
{ inputs }:
let
overlays = [
./attic
./zipline
./bitwarden
];
importedOverlays = map (m: import m) overlays;
in
importedOverlays
++ [
[
(
final: prev:
let
@ -19,6 +17,9 @@ importedOverlays
conduwuit =
pkgFrom inputs.conduwuit "static-x86_64-linux-musl-all-features-x86_64-haswell-optimised";
pixelflasher = nixpkgsFrom inputs.pixelflasher "pixelflasher";
attic-server = pkgFrom inputs.attic "attic-server";
attic = pkgFrom inputs.attic "attic";
}
)
]
]
++ importedOverlays

File diff suppressed because one or more lines are too long