How to Install Samba on NixOS Latest
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.
Prerequisites
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 Samba
Install the Samba package by running the following command:
sudo nix-env -iA nixos.sambaThis will install Samba on your system.
Configure Samba by creating a configuration file.
sudo nano /etc/samba/smb.confPaste the following lines into the file:
[global] workgroup = WORKGROUP security = user passdb backend = tdbsam [share] path = /srv/share read only = noThis 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/shareSet the permissions for the directory:
sudo chmod -R 777 /srv/shareFinally, 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.