diff --git a/nfs/CHANGELOG.md b/nfs/CHANGELOG.md new file mode 100644 index 0000000..49adc3d --- /dev/null +++ b/nfs/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## 1.0.0 - 2026-03-29 + +- Initial release diff --git a/nfs/Dockerfile b/nfs/Dockerfile new file mode 100644 index 0000000..3e9b333 --- /dev/null +++ b/nfs/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine:3.19 +RUN apk add --no-cache nfs-utils +COPY run.sh / +RUN chmod +x /run.sh +CMD ["/run.sh"] \ No newline at end of file diff --git a/nfs/README.md b/nfs/README.md new file mode 100644 index 0000000..7bb4f99 --- /dev/null +++ b/nfs/README.md @@ -0,0 +1,24 @@ +# Home Assistant Add-on: NFS Server + +This add-on exposes the Home Assistant media folder via NFS. + +## Configuration + +The following configuration options are available: + +- `allowed_network`: The network allowed to access the NFS share (e.g., `192.168.1.0/24`). Defaults to `0.0.0.0/0` (everyone). It is highly recommended to restrict this to your local network. + +## How to use + +1. Start the add-on. +2. On your client machine, mount the NFS share. The NFS share will be the IP of your Home Assistant instance, and the exported path is `/media`. + + Example on a Linux client: + ```bash + mkdir /mnt/hass-media + mount -t nfs :/media /mnt/hass-media + ``` + +## Notes + +This addon requires `host_network` and `SYS_ADMIN` privileges to run. diff --git a/nfs/config.yaml b/nfs/config.yaml new file mode 100644 index 0000000..fa2d079 --- /dev/null +++ b/nfs/config.yaml @@ -0,0 +1,11 @@ +name: NFS Server +version: "1.0.0" +slug: nfs_server +description: Expose Home Assistant media folder via NFS. +arch: [aarch64, amd64, armv7, i386, x86_64] +privileged: [SYS_ADMIN] +apparmor: false +host_network: true +map: + - media:rw +ports: {} \ No newline at end of file diff --git a/nfs/options_schema.json b/nfs/options_schema.json new file mode 100644 index 0000000..d51b78d --- /dev/null +++ b/nfs/options_schema.json @@ -0,0 +1,8 @@ +[ + { + "name": "allowed_network", + "type": "string", + "description": "The network allowed to access the NFS share (e.g., 192.168.1.0/24)", + "default": "0.0.0.0/0" + } +] \ No newline at end of file diff --git a/nfs/run.sh b/nfs/run.sh new file mode 100644 index 0000000..1307934 --- /dev/null +++ b/nfs/run.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bashio + +# Read config +NETWORK=$(bashio::config 'allowed_network') + +# Setup exports +bashio::log.info "Exporting /media folder to ${NETWORK}..." +echo "/media ${NETWORK}(rw,sync,no_subtree_check,no_root_squash)" > /etc/exports +cat /etc/exports + +# Start NFS services +bashio::log.info "Starting NFS services..." +rpcbind +exportfs -ra + +# Start rpc.statd for file locking +rpc.statd & +# Start the NFS server kernel threads +rpc.nfsd + +# Start rpc.mountd in the foreground to keep the container running +exec rpc.mountd --no-udp -F \ No newline at end of file