Samba is a popular open-source software suite used to provide file and print services between different operating systems. In this tutorial, we will show you how to install Samba on the latest version of NixOS.
Before you proceed with the installation, make sure your system is up-to-date by running the following command:
sudo nix-channel --update && sudo nixos-rebuild switch
Install the Samba package by running the following command:
sudo nix-env -iA nixos.samba
This will install Samba on your system.
Configure Samba by creating a configuration file.
sudo nano /etc/samba/smb.conf
Paste the following lines into the file:
[global]
workgroup = WORKGROUP
security = user
passdb backend = tdbsam
[share]
path = /srv/share
read only = no
This configuration sets up a share folder at /srv/share
. You can change this value to any folder of your choice.
Create the directory for the share:
sudo mkdir /srv/share
Set the permissions for the directory:
sudo chmod -R 777 /srv/share
Finally, start the Samba service:
sudo systemctl start smb
Congratulations! You have successfully installed and configured Samba on NixOS. You can now access your shared folder from any device on your network.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!