Compare commits

..

7 commits

11 changed files with 124 additions and 53 deletions

43
flake.lock generated
View file

@ -448,6 +448,30 @@
"type": "github" "type": "github"
} }
}, },
"helix": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": "nixpkgs_4",
"rust-overlay": [
"rust-overlay"
]
},
"locked": {
"lastModified": 1742479163,
"narHash": "sha256-YC0zdGyZMu7seA2Jm1mxtcxE4lSeVwvCPMfWzJ8+o/c=",
"owner": "helix-editor",
"repo": "helix",
"rev": "b7d735ffe66a03ab5970e5f860923aada50d4e4c",
"type": "github"
},
"original": {
"owner": "helix-editor",
"repo": "helix",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -827,6 +851,22 @@
} }
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": {
"lastModified": 1740560979,
"narHash": "sha256-Vr3Qi346M+8CjedtbyUevIGDZW8LcA1fTG0ugPY/Hic=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5135c59491985879812717f4c9fea69604e7f26f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1742276595, "lastModified": 1742276595,
"narHash": "sha256-bsg9y3NoMGu0jgTI5XbxvzQFc9JtZB51i500WlVws80=", "narHash": "sha256-bsg9y3NoMGu0jgTI5XbxvzQFc9JtZB51i500WlVws80=",
@ -973,13 +1013,14 @@
"flake-parts": "flake-parts_2", "flake-parts": "flake-parts_2",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"garage": "garage", "garage": "garage",
"helix": "helix",
"home-manager": "home-manager", "home-manager": "home-manager",
"lanzaboote": "lanzaboote", "lanzaboote": "lanzaboote",
"lix-module": "lix-module", "lix-module": "lix-module",
"nil": "nil", "nil": "nil",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nix-ld": "nix-ld", "nix-ld": "nix-ld",
"nixpkgs": "nixpkgs_4", "nixpkgs": "nixpkgs_5",
"nixpkgs-stable": "nixpkgs-stable_2", "nixpkgs-stable": "nixpkgs-stable_2",
"nixvim": "nixvim", "nixvim": "nixvim",
"nvim-github-theme": "nvim-github-theme", "nvim-github-theme": "nvim-github-theme",

View file

@ -92,6 +92,11 @@
flake-utils.follows = "flake-utils"; flake-utils.follows = "flake-utils";
}; };
}; };
helix = {
url = "github:helix-editor/helix";
inputs.flake-utils.follows = "flake-utils";
inputs.rust-overlay.follows = "rust-overlay";
};
nvim-github-theme = { nvim-github-theme = {
url = "github:projekt0n/github-nvim-theme"; url = "github:projekt0n/github-nvim-theme";

View file

@ -167,6 +167,7 @@
installCargo = false; installCargo = false;
}; };
eslint.enable = true; eslint.enable = true;
yamlls.enable = true;
}; };
}; };
plugins.treesitter = { plugins.treesitter = {
@ -198,13 +199,6 @@
settings.current_line_blame = true; settings.current_line_blame = true;
}; };
plugins.copilot-chat = {
enable = true;
settings = {
model = "claude-3.5-sonnet";
};
};
plugins.cmp-buffer.enable = true; plugins.cmp-buffer.enable = true;
plugins.cmp-emoji.enable = true; plugins.cmp-emoji.enable = true;
plugins.cmp-nvim-lsp.enable = true; plugins.cmp-nvim-lsp.enable = true;

View file

@ -14,8 +14,4 @@
programs.home-manager.enable = true; programs.home-manager.enable = true;
systemd.user.startServices = "sd-switch"; systemd.user.startServices = "sd-switch";
home.packages = with pkgs; [
attic-server
];
} }

View file

@ -152,4 +152,17 @@
}; };
programs.nix-index-database.comma.enable = true; programs.nix-index-database.comma.enable = true;
programs.helix = {
enable = true;
settings = {
theme = "github_dark";
editor = {
line-number = "relative";
lsp.display-messages = true;
};
keys.insert = {
"C-[" = "normal_mode";
};
};
};
} }

View file

@ -15,7 +15,7 @@
replication_factor = 1; replication_factor = 1;
db_engine = "lmdb"; db_engine = "lmdb";
disable_scrub = true; disable_scrub = true;
block_size = "10M"; block_size = "128M";
compression_level = "none"; compression_level = "none";
}; };
environmentFile = config.sops.secrets."garage/env".path; environmentFile = config.sops.secrets."garage/env".path;

View file

@ -9,6 +9,7 @@ let
thumbsLocation = "/opt/immich/thumbs"; thumbsLocation = "/opt/immich/thumbs";
profileLocation = "/opt/immich/profile"; profileLocation = "/opt/immich/profile";
dbDataLocation = "/opt/immich/postgres"; dbDataLocation = "/opt/immich/postgres";
backupsLocation = "/opt/immich/backups";
in in
{ {
virtualisation.oci-containers.containers = { virtualisation.oci-containers.containers = {
@ -21,6 +22,7 @@ in
"${uploadLocation}:/usr/src/app/upload" "${uploadLocation}:/usr/src/app/upload"
"${thumbsLocation}:/usr/src/app/upload/thumbs" "${thumbsLocation}:/usr/src/app/upload/thumbs"
"${profileLocation}:/usr/src/app/upload/profile" "${profileLocation}:/usr/src/app/upload/profile"
"${backupsLocation}:/usr/src/app/upload/backups"
]; ];
environment = { environment = {
REDIS_HOSTNAME = "immich-redis"; REDIS_HOSTNAME = "immich-redis";

View file

@ -4,41 +4,11 @@
lib, lib,
... ...
}: }:
{ let
systemd.services.immich-mount = { mkServiceConfig = remote: mount: {
enable = true;
description = "Mount the immich data remote";
requires = [ "network-online.target" ];
after = [ "network-online.target" ];
requiredBy = [ "podman-immich-server.service" ];
before = [ "podman-immich-server.service" ];
serviceConfig = {
Type = "notify"; Type = "notify";
ExecStartPre = "/usr/bin/env mkdir -p /mnt/photos"; TimeoutSec = "5min 20s";
ExecStart = '' ExecStartPre = "/usr/bin/env mkdir -p ${mount}";
${lib.getExe pkgs.rclone} mount \
--config ${config.sops.secrets."rclone/config".path} \
--cache-dir /var/cache/rclone \
--transfers=32 \
--dir-cache-time 30d \
--vfs-cache-mode writes \
--vfs-cache-max-size 2G \
photos: /mnt/photos
'';
ExecStop = "${lib.getExe' pkgs.fuse "fusermount"} -u /mnt/photos";
};
};
systemd.services.garage-mount = {
enable = true;
description = "Mount the garage data remote";
requires = [ "network-online.target" ];
after = [ "network-online.target" ];
requiredBy = [ "garage.service" ];
before = [ "garage.service" ];
serviceConfig = {
Type = "notify";
ExecStartPre = "/usr/bin/env mkdir -p /mnt/garage";
ExecStart = '' ExecStart = ''
${lib.getExe pkgs.rclone} mount \ ${lib.getExe pkgs.rclone} mount \
--config ${config.sops.secrets."rclone/config".path} \ --config ${config.sops.secrets."rclone/config".path} \
@ -52,12 +22,32 @@
--no-modtime \ --no-modtime \
--vfs-fast-fingerprint \ --vfs-fast-fingerprint \
--vfs-read-chunk-size 4M \ --vfs-read-chunk-size 4M \
--vfs-read-chunk-streams 64 \ --vfs-read-chunk-streams 32 \
--sftp-concurrency 128 \ --sftp-concurrency 128 \
--sftp-chunk-size 255k \ --sftp-chunk-size 255k \
rsyncnet:garage /mnt/garage ${remote} ${mount}
''; '';
ExecStop = "${lib.getExe' pkgs.fuse "fusermount"} -u /mnt/garage"; ExecStop = "${lib.getExe' pkgs.fuse "fusermount"} -zu ${mount}";
}; };
in
{
systemd.services.immich-mount = {
enable = true;
description = "Mount the immich data remote";
requires = [ "network-online.target" ];
after = [ "network-online.target" ];
requiredBy = [ "podman-immich-server.service" ];
before = [ "podman-immich-server.service" ];
serviceConfig = mkServiceConfig "photos:" "/mnt/photos";
};
systemd.services.garage-mount = {
enable = true;
description = "Mount the garage data remote";
requires = [ "network-online.target" ];
after = [ "network-online.target" ];
requiredBy = [ "garage.service" ];
before = [ "garage.service" ];
serviceConfig = mkServiceConfig "rsyncnet:garage" "/mnt/garage";
}; };
} }

View file

@ -30,12 +30,31 @@ in
type = "s3"; type = "s3";
region = "us-east-1"; region = "us-east-1";
bucket = "attic"; bucket = "attic";
endpoint = "https://s3.cy7.sh"; # attic must be patched to never serve pre-signed s3 urls directly
# otherwise it will redirect clients to this localhost endpoint
endpoint = "http://127.0.0.1:3900";
}; };
garbage-collection = { garbage-collection = {
default-retention-period = "1 month"; default-retention-period = "1 month";
}; };
chunking = {
# disable chunking since garage does its own
nar-size-threshold = 0;
# defaults
min-size = 16384;
avg-size = 65536;
max-size = 262144;
};
};
};
systemd.services.atticd = {
requires = [ "garage.service" ];
after = [ "garage.service" ];
environment = {
RUST_LOG = "INFO";
}; };
}; };

View file

@ -1,7 +1,16 @@
diff --git a/server/src/api/binary_cache.rs b/server/src/api/binary_cache.rs diff --git a/server/src/api/binary_cache.rs b/server/src/api/binary_cache.rs
index 02e4857..71eeee8 100644 index 02e4857..b522154 100644
--- a/server/src/api/binary_cache.rs --- a/server/src/api/binary_cache.rs
+++ b/server/src/api/binary_cache.rs +++ b/server/src/api/binary_cache.rs
@@ -215,7 +215,7 @@ async fn get_nar(
let chunk = chunks[0].as_ref().unwrap();
let remote_file = &chunk.remote_file.0;
let storage = state.storage().await?;
- match storage.download_file_db(remote_file, false).await? {
+ match storage.download_file_db(remote_file, true).await? {
Download::Url(url) => Ok(Redirect::temporary(&url).into_response()),
Download::AsyncRead(stream) => {
let stream = ReaderStream::new(stream).map_err(|e| {
@@ -262,7 +262,7 @@ async fn get_nar( @@ -262,7 +262,7 @@ async fn get_nar(
// TODO: Make num_prefetch configurable // TODO: Make num_prefetch configurable
@ -11,3 +20,4 @@ index 02e4857..71eeee8 100644
tracing::error!(%e, "Stream error"); tracing::error!(%e, "Stream error");
e e
}); });

View file

@ -24,6 +24,7 @@ in
meta.mainProgram = "garage"; meta.mainProgram = "garage";
} }
); );
helix = pkgFrom inputs.helix "default";
} }
) )
] ]