[NixOS] Fix command

This commit is contained in:
Ivan Malison 2024-10-07 15:16:16 -06:00
parent 8e1abde359
commit ae6ce6b19c

View File

@ -40,16 +40,14 @@ in {
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
RemainAfterExit = true; RemainAfterExit = true;
# ExecStartPre runs as root (the default), to perform the setup steps
ExecStartPre = [ ExecStartPre = [
"-${pkgs.util-linux}/bin/umount -f ${mount-path}" # Ensure unmount if already mounted "-${pkgs.util-linux}/bin/umount -f ${mount-path}"
"${pkgs.coreutils}/bin/mkdir -p ${mount-path}" # Create the mount point "${pkgs.coreutils}/bin/mkdir -p ${mount-path}"
"${pkgs.coreutils}/bin/chown railbird:users ${mount-path}" # Ensure the directory is owned by railbird and group users "${pkgs.coreutils}/bin/chown railbird:users ${mount-path}"
"${pkgs.coreutils}/bin/chmod 0775 ${mount-path}" # Give read/write/execute to owner and group, and read/execute to others "${pkgs.coreutils}/bin/chmod 0775 ${mount-path}"
]; ];
# Mount the GCS bucket ExecStart = "${pkgs.gcsfuse}/bin/gcsfuse --implicit-dirs --key-file ${config.age.secrets.api-service-key.path} ${bucket-name} ${mount-path}";
ExecStart = "${pkgs.gcsfuse}/bin/gcsfuse --implicit-dirs --key-file ${config.age.secrets.api-service-key.path} --uid $(id -u railbird) --gid $(id -g users) ${bucket-name} ${mount-path}"; User = "root";
User = "root"; # Needs to run as root for mounting
}; };
}; };