Add nix-cache

This commit is contained in:
Jakob Lechner 2025-09-03 21:37:54 +02:00
parent e2e135718d
commit 0405c345e2
7 changed files with 80 additions and 0 deletions

1
nix-cache/.envrc Normal file
View file

@ -0,0 +1 @@
use nix

1
nix-cache/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/.direnv/

5
nix-cache/Dockerfile Normal file
View file

@ -0,0 +1,5 @@
FROM ghcr.io/zhaofengli/attic:latest
COPY ./entrypoint.sh /entrypoint.sh
COPY ./server.toml /attic/server.toml.tmpl
EXPOSE 8080
ENTRYPOINT ["/entrypoint.sh"]

12
nix-cache/entrypoint.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
set -e
sed \
-e "s/!!POSTGRES_PASSWORD!!/${POSTGRES_PASSWORD}/g" \
/attic/server.toml.tmpl \
> /run/server.toml
exec /bin/atticd \
-f /run/server.toml \
--mode monolithic

22
nix-cache/fly.toml Normal file
View file

@ -0,0 +1,22 @@
# fly.toml app configuration file generated for jalr-attic on 2025-09-03T19:29:39+02:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = 'jalr-attic'
primary_region = 'fra'
swap_size_mb = 256
[build]
[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 0
processes = ['app']
[[vm]]
size = 'shared-cpu-1x'
memory = '512mb'

29
nix-cache/server.toml Normal file
View file

@ -0,0 +1,29 @@
listen = "[::]:8080"
[database]
url = "postgresql://neondb_owner:!!POSTGRES_PASSWORD!!@ep-raspy-snow-aggvse7u-pooler.c-2.eu-central-1.aws.neon.tech/neondb?sslmode=require&channel_binding=require"
[storage]
bucket = "jalr-attic"
type = "s3"
region = "auto"
endpoint = "https://1b34998519526958a742d40d38834033.eu.r2.cloudflarestorage.com"
#[storage.credentials]
#access_key_id = "" # AWS_ACCESS_KEY_ID
#secret_access_key = "" # AWS_SECRET_ACCESS_KEY
[chunking]
nar-size-threshold = 65536
min-size = 16384
avg-size = 65536
max-size = 262144
[compression]
type = "zstd"
[garbage-collection]
interval = "12 hours"
#[jwt.signing]
#token-hs256-secret-base64 = "" # ATTIC_SERVER_TOKEN_HS256_SECRET_BASE64

10
nix-cache/shell.nix Normal file
View file

@ -0,0 +1,10 @@
with import <nixpkgs> { };
mkShellNoCC {
buildInputs = [
flyctl
];
shellHook = ''
export FLY_ACCESS_TOKEN=$(pass show private/services/fly.io/app-jalr-attic)
'';
}