From c574b8d10683954e58942906e57f949acd83a6b1 Mon Sep 17 00:00:00 2001 From: Filippo Berto Date: Tue, 8 Aug 2023 14:31:53 +0200 Subject: [PATCH] Update mount config --- instances/odin/hm.nix | 46 +++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/instances/odin/hm.nix b/instances/odin/hm.nix index 12d5db9..7b2f98e 100644 --- a/instances/odin/hm.nix +++ b/instances/odin/hm.nix @@ -42,26 +42,34 @@ ''; }; - systemd.user.services.garage-home-s3 = { - Unit = { - After = [ "network.target" "network-online.target" "local-fs.target" ]; - AssertPathIsDirectory = "/home/bertof/s3"; - AssertPathIsReadWrite = "/home/bertof/s3"; - Description = "Mount S3 bucket in bertof's home"; - StartLimitBurst = 5; - StartLimitInterval = 200; - Wants = [ "network.target" "network-online.target" ]; + systemd.user.services.garage-home-s3-bertof = + let + path = "/home/bertof/s3/bertof"; + in + { + Unit = { + After = [ "network.target" "network-online.target" "local-fs.target" ]; + # AssertPathIsDirectory = path; + # AssertPathIsReadWrite = path; + Description = "Mount S3 bucket in bertof's home"; + StartLimitBurst = 5; + StartLimitInterval = 200; + Wants = [ "network.target" "network-online.target" ]; + }; + Service = { + ExecStart = pkgs.writeShellScript "garage-home-s3-bertof" '' + set -e + ${pkgs.coreutils}/bin/mkdir -p '${path}' + ${pkgs.s3fs}/bin/s3fs -f -d bertof ${path} -o passwd_file=${nixosConfig.age.secrets.garage_bertof_odin_key.path},use_path_request_style,url=http://localhost:3900 + ''; + Restart = "always"; + RestartSec = 30; + Type = "exec"; + }; + Install = { + # WantedBy = [ "default.target" ]; + }; }; - Service = { - ExecStart = "${pkgs.s3fs}/bin/s3fs -f -d bertof /home/bertof/s3 -o passwd_file=${nixosConfig.age.secrets.garage_bertof_odin_key.path},use_path_request_style,url=http://localhost:3900"; - Restart = "always"; - RestartSec = 30; - Type = "exec"; - }; - Install = { - # WantedBy = [ "default.target" ]; - }; - }; imports = [ ../../modules/hm/__basic.nix