Skip to content

Commit 9f69025

Browse files
committed
chore(immich): external backup option from SWheeler
1 parent e2330aa commit 9f69025

File tree

3 files changed

+63
-6
lines changed

3 files changed

+63
-6
lines changed

home-manager/swheeler/default.nix

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
{ pkgs, ... }:
22

33
{
4-
imports = [ ../home.nix ../server.nix ./appart.nix ];
5-
6-
home.packages = with pkgs; [
7-
python39
8-
python39Packages.virtualenv
4+
imports = [
5+
../home.nix
6+
../server.nix
7+
# ./appart.nix
98
];
9+
10+
# home.packages = with pkgs; [
11+
# python39
12+
# python39Packages.virtualenv
13+
# ];
1014
}

swheeler/configuration.nix

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
./hardware-configuration.nix
88
<home-manager/nixos>
99
../tchekda_user.nix
10+
# ./immich-backup.nix
1011
];
1112

1213
boot = {
@@ -20,7 +21,10 @@
2021
};
2122
};
2223

23-
documentation.enable = false;
24+
documentation = {
25+
enable = false;
26+
man.enable = false;
27+
};
2428

2529
environment.systemPackages = with pkgs; [
2630
git
@@ -74,6 +78,8 @@
7478

7579
nixpkgs.config.allowUnfree = true;
7680

81+
programs.fish.enable = true;
82+
7783
services = {
7884
openssh = {
7985
enable = true;

swheeler/immich-backup.nix

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{ pkgs, ... }:
2+
{
3+
environment.systemPackages = [ pkgs.cifs-utils ];
4+
fileSystems."/mnt/fbx" = {
5+
device = "//192.168.0.254/Freebox";
6+
fsType = "cifs";
7+
options =
8+
let
9+
# this line prevents hanging on network split
10+
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
11+
12+
in
13+
[ automount_opts ];
14+
};
15+
systemd = {
16+
services = {
17+
immich-backup-job =
18+
let
19+
rsyncExclude = pkgs.writeText "rsync-exclude" ''
20+
encoded-video/
21+
thumbs/
22+
.immich
23+
library/2bfeb95a-a27a-4d82-95f9-23440d704084/
24+
'';
25+
in
26+
{
27+
after = [ "network.target" ];
28+
description = "Backup immich folders";
29+
serviceConfig = {
30+
ExecStart = "${pkgs.rsync}/bin/rsync -e '${pkgs.openssh}/bin/ssh' -rthvzP --stats --exclude-from=${rsyncExclude} [email protected]:/srv/immich-upload/ /mnt/fbx/Photos/Backup-Immich/";
31+
};
32+
};
33+
};
34+
35+
timers.immich-backup-job = {
36+
description = "Trigger a backup of immich folders";
37+
38+
timerConfig = {
39+
OnCalendar = "*-*-* 04:00:00";
40+
Persistent = true;
41+
Unit = "immich-backup-job.service";
42+
};
43+
44+
wantedBy = [ "timers.target" ];
45+
};
46+
};
47+
}

0 commit comments

Comments
 (0)