From f629867b9a38f4ed10a3345f00236453d267ca0c Mon Sep 17 00:00:00 2001 From: xinyangli Date: Wed, 9 Apr 2025 08:50:54 +0800 Subject: [PATCH] calcite: mount photo directory with davfs2 --- machines/calcite/configuration.nix | 52 ++++++++++++++++++++++++++++++ machines/calcite/fix-crash.patch | 36 +++++++++++++++++++++ machines/calcite/secrets.yaml | 8 +++-- 3 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 machines/calcite/fix-crash.patch diff --git a/machines/calcite/configuration.nix b/machines/calcite/configuration.nix index 5a67f45..be788a3 100644 --- a/machines/calcite/configuration.nix +++ b/machines/calcite/configuration.nix @@ -317,6 +317,12 @@ in gthumb oculante + (epsonscan2.overrideAttrs ( + finalAttrs: prevAttrs: { + patches = prevAttrs.patches ++ [ ./fix-crash.patch ]; + } + )) + # Multimedia vlc obs-studio @@ -365,6 +371,26 @@ in owner = "root"; sopsFile = ./secrets.yaml; }; + "davfs2/photosync_password" = { + sopsFile = ./secrets.yaml; + mode = "0600"; + }; + }; + + sops.templates."davfs2.conf" = { + owner = config.services.davfs2.davUser; + content = '' + https://weilite.coho-tet.ts.net:6065/photosync photosync ${ + config.sops.placeholder."davfs2/photosync_password" + } + ''; + }; + + environment.etc = { + "davfs2/secrets" = { + source = config.sops.templates."davfs2.conf".path; + mode = "0600"; + }; }; custom.restic = { @@ -399,6 +425,32 @@ in services.flatpak.enable = true; + services.davfs2 = { + enable = true; + settings = { + globalSection = { + use_locks = 1; + gui_optimize = 1; + table_size = 4096; + cache_size = 10240; + }; + }; + }; + + fileSystems = { + "/media/photosync" = { + device = "https://weilite.coho-tet.ts.net:6065/photosync"; + fsType = "davfs"; + options = [ + "rw" + "uid=1000" + "nodev" + "nosuid" + "nofail" + ]; + }; + }; + # Fonts fonts = { packages = with pkgs; [ diff --git a/machines/calcite/fix-crash.patch b/machines/calcite/fix-crash.patch new file mode 100644 index 0000000..0c53be0 --- /dev/null +++ b/machines/calcite/fix-crash.patch @@ -0,0 +1,36 @@ +diff -uNr a/src/Controller/Src/Finder/UsbFinder.cpp b/src/Controller/Src/Finder/UsbFinder.cpp +--- a/src/Controller/Src/Finder/UsbFinder.cpp 2024-10-05 01:47:57.530027467 +0800 ++++ b/src/Controller/Src/Finder/UsbFinder.cpp 2024-10-07 01:58:36.293405252 +0800 +@@ -119,14 +119,26 @@ + sprintf(const_cast(devInfo.displayName), "%s", "DS-5500/DS-6500/DS-7500"); + isValidDeviceInfo = true; + } ++ else if (dd.idProduct == 0x14A) ++ { ++ sprintf(const_cast(devInfo.displayName), "%s", "Perfection V37/V370"); ++ isValidDeviceInfo = true; ++ } + else + { +- sprintf((char*)strDescWithAddress, "%s:%s", strDesc, serialNumber); +- strncpy(const_cast(devInfo.displayName),(const char*)strDescWithAddress, MAX_DISPLAYNAME - 1); +- if (strlen(devInfo.displayName) != 0 || searchSecondDevice) +- { +- isValidDeviceInfo = true; +- } ++ if (dd.iSerialNumber == 0) ++ { ++ sprintf((char*)strDescWithAddress, "%s", strDesc); ++ } ++ else ++ { ++ sprintf((char*)strDescWithAddress, "%s:%s", strDesc, serialNumber); ++ } ++ strncpy(const_cast(devInfo.displayName),(const char*)strDescWithAddress, MAX_DISPLAYNAME - 1); ++ if (strlen(devInfo.displayName) != 0 || searchSecondDevice) ++ { ++ isValidDeviceInfo = true; ++ } + } + libusb_close (devHandle); + devHandle = nullptr; diff --git a/machines/calcite/secrets.yaml b/machines/calcite/secrets.yaml index ee5dc17..f6ff278 100644 --- a/machines/calcite/secrets.yaml +++ b/machines/calcite/secrets.yaml @@ -3,6 +3,8 @@ restic: repo_password: ENC[AES256_GCM,data:jqsIP1R5/yX8F0oYaSXACx6C,iv:KckzqctKLnmay+d30/Y4IttiASxYnMw6IHQrtwP2YdQ=,tag:L/Ij51UU1om48I8fd4iuwA==,type:str] gitea: envfile: ENC[AES256_GCM,data:CK+JNELuzjKgWnImuV4Euif3f3nNOACOrvc4NiIXs+q/F7QWrtpb3TK8/FrLNQk=,iv:QSDrlKJCBld2gDx/y1sT8anh37GhqSS2QZd2JJi5Yis=,tag:x5T6h59LBXhEyVwSr2dnuQ==,type:str] +davfs2: + photosync_password: ENC[AES256_GCM,data:J3+pJCjjV+hlPC2il5f7Vn+9k+Aatolgut1DX1G+JF4=,iv:OgZn6Glho3Cfrl0GJhGSbmcYjSe6sjM9PjvEZnM/c4w=,tag:i5AVG139nK3ecK3VwWpQuQ==,type:str] sops: kms: [] gcp_kms: [] @@ -27,8 +29,8 @@ sops: WGlLdXVoZlp3bEFXZjlMdG1VOUZDNUkKQ2NNTE3OsNUr2pOI7qeNFSCVkUIVRS+g FG5FbJJcFihXqr+Qo0nZkq+xq07vIia7mKoqyoIfkKwweiVzDKyrkQ== -----END AGE ENCRYPTED FILE----- - lastmodified: "2024-11-28T03:55:19Z" - mac: ENC[AES256_GCM,data:VH7RnRT33ltsxycuSsUsM+64onQeClwQ3fIHUVQUyRJ6t7aJkBiGMQ80QtmwGE5CJTbq7LV4cis5Pq/f9vTb0SsY4tCSIgXNAE2zW2rjjQKjdHr+rnnKSJExJA+k2tL06Q/FUu+3SP7pVSaYBGQKb53UAbHsdJYbx00Ko6MzZ7U=,iv:EiYhbr6o4n3kGEEWKXeWmDPSb5hOvUhRH7N2ZLPRHmQ=,tag:BdI140bhvBW0bwQPpRYiRw==,type:str] + lastmodified: "2025-04-07T08:57:13Z" + mac: ENC[AES256_GCM,data:UvMXEu2UFapYNHa7kxvFhDzvJZvuV6mwRqmxFISDpp0VhRhY1+Mj2GFxrS5RgTW1ozUnCB0DSBUwWcmsPZeOUveMkHqqRFGZIjinh6blwseZjJMOR30KG3atY6L2adOOZaBERi+HJXqXfdqymeSCmkMC5iJ2jt2KGuMx5NqSfbE=,iv:pueL1hT/tvug65KPYxqY3RwNYeBOlGpIFf70+26VOYQ=,tag:VLwuipBxchMBSSuOMXYKJQ==,type:str] pgp: [] unencrypted_suffix: _unencrypted - version: 3.9.1 + version: 3.9.4