Skip to content

Commit

Permalink
feat: add attic nix cache
Browse files Browse the repository at this point in the history
  • Loading branch information
icecreammatt committed Feb 3, 2024
1 parent e753198 commit ebc6d90
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .secrets/.sops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ creation_rules:
key_groups:
- age:
- *primary
- path_regex: .secrets/attic.ini$
key_groups:
- age:
- *primary
- path_regex: .secrets/woodpecker.ini$
key_groups:
- age:
Expand Down
9 changes: 9 additions & 0 deletions .secrets/attic.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ATTIC_SERVER_TOKEN_HS256_SECRET_BASE64 = ENC[AES256_GCM,data:SisQvE+Mur6+fsUiEA089sBre5upEfGDzsqN3XqDYes+uKgMv4hhplsJwu2R0z45fSS2EKdr3fl3T9imUZEuAirpReiOuaB0lr+dvy+bajYH1SHDbCQSOA==,iv:Ii9+19YK+rS6IrrP56DvJTabM3xHSpTcnWPc5Q6VeBg=,tag:ejbXCZSazzb/stsTGhRXnw==,type:str]

[sops]
age__list_0__map_recipient = age1m6p5fqprcepsuwdntzw2khdgstmd28y2us3xvdeqqflz7s5yf34sydejuz
unencrypted_suffix = _unencrypted
version = 3.8.1
age__list_0__map_enc = -----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBIeDBxVXdTNWZMWHpBYUJI\nZjY4Y0c4bkNXMjJIYmJTU1dXVmNHQ3pQMUU4CmFnY0lyQTJMQ3BveWVwemt3V0Vp\nVllrZVdGdWRzbXpVSkNlR3hsWmVkWkEKLS0tIEhrUDYzeElRV0JJRWlETlhjbzZs\nOVN3WDA2VjlPZkMwOTZ4M3hST1BVUHMKCclaEUCx3lEAjoRtJ6f7aibOUNOmjkfR\nZY/cfsNKk7yoLiTOmuPdWuuyRFEXCreh45FwBE1EnuoMqiS1oBROHA==\n-----END AGE ENCRYPTED FILE-----\n
lastmodified = 2024-02-02T09:53:18Z
mac = ENC[AES256_GCM,data:fDVvoogTzh+s20BpRGMjacwKnNrGpuf9/6yX52QfWwVX7weDQ/7fDiR33pIAofz3RPYLqh3Go6fsTzwzRgOoHGmqD7tW6iRVREDTkrpuiBzd1pmbdtrUCoEsir/GeTsBJOr10KV0kUxSbw2TVyxviT6tPlJW1P/Sovd2ss7Uy/4=,iv:i6pX1IsPGWg3sPG56d4O5TVHQsDUv24U8yXVatenkA0=,tag:tbxkOsvzs9boGkOR6Qar7Q==,type:str]
105 changes: 99 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
url = "github:icecreammatt/helix/refs/tags/2024-01-29";
inputs.nixpkgs.follows = "nixpkgs";
};

attic = {
url = "github:zhaofengli/attic";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = inputs @ {
Expand All @@ -51,13 +56,14 @@
sops-nix,
helix-flake,
xremap-flake,
attic,
...
}: {
# Gaming PC, VM, Raspberry Pi
nixosConfigurations = (
import ./hosts/nixos {
inherit (nixpkgs) lib;
inherit inputs nixpkgs nixos-hardware home-manager hyprland sops-nix helix-flake;
inherit inputs nixpkgs nixos-hardware home-manager hyprland sops-nix helix-flake attic;
}
);

Expand Down
2 changes: 2 additions & 0 deletions hosts/nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
hyprland,
helix-flake,
sops-nix,
attic,
...
}: let
user = "matt";
Expand Down Expand Up @@ -158,6 +159,7 @@ in {
helix-flake.packages."x86_64-linux".default
];
}
attic.nixosModules.atticd
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
{
Expand Down
6 changes: 6 additions & 0 deletions hosts/nixos/mini/caddy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ in {
${reverse_proxy_string 8081}
'';

virtualHosts."attic.${domain}".extraConfig = ''
${tlsConfig}
${reverse_proxy_string 8072}
'';

# Silverbullet
virtualHosts."notes.${domain}".extraConfig = ''
${tlsConfig}
Expand Down
40 changes: 40 additions & 0 deletions hosts/nixos/mini/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,46 @@
print-manager
];

sops.secrets."attic/ATTIC_SERVER_TOKEN_HS256_SECRET_BASE64" = {
sopsFile = ../../../.secrets/attic.ini;
format = "ini";
};

services.atticd = {
enable = true;

# Replace with absolute path to your credentials file
# credentialsFile = "/etc/atticd.env";
credentialsFile = config.sops.secrets."attic/ATTIC_SERVER_TOKEN_HS256_SECRET_BASE64".path; # "/path/to/my/secrets/file";

settings = {
listen = "127.0.0.1:8072";

# Data chunking
#
# Warning: If you change any of the values here, it will be
# difficult to reuse existing chunks for newly-uploaded NARs
# since the cutpoints will be different. As a result, the
# deduplication ratio will suffer for a while after the change.
chunking = {
# The minimum NAR size to trigger chunking
#
# If 0, chunking is disabled entirely for newly-uploaded NARs.
# If 1, all NARs are chunked.
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
};
};
};

systemd.timers."gauge-check" = {
wantedBy = ["timers.target"];
timerConfig = {
Expand Down

0 comments on commit ebc6d90

Please sign in to comment.