Installing imgproxy on NixOS

Imgproxy is an open-source image resizing and processing server that allows for easy and efficient manipulation of images in real-time. In this tutorial, we'll be discussing how to install imgproxy on NixOS.

Prerequisites

Before starting the installation process, make sure that the following requirements have been met:

Step 1: Install Dependency Packages

Imgproxy requires libvips and libgsf to work correctly. So, we'll need to install these packages before proceeding with the actual installation.

To install these dependencies, run the following commands in your terminal:

sudo nix-env -iA nixpkgs.glib
sudo nix-env -iA nixpkgs.vips

Now, with the required dependencies installed, we can proceed to install imgproxy.

Step 2: Install Imgproxy

To install imgproxy on NixOS, we'll use the Nix package manager. Imgproxy is available from the Nix package manager's default repository, so we can install it by running the following command:

sudo nix-env -iA nixpkgs.imgproxy

With this command, imgproxy will be installed on your system.

Step 3: Configure Imgproxy

After installing imgproxy, the next step is to configure it for use. By default, the imgproxy configuration file is located at /etc/imgproxy.conf. However, you can specify a different location by using the -config flag with the imgproxy command.

To configure imgproxy, open the /etc/imgproxy.conf file using your preferred text editor.

sudo nano /etc/imgproxy.conf

Now, let's add the following configuration options to the file and save it:

addr = "127.0.0.1:8080"

use_filesystem_cache = false

jpeg_quality = 95

jpeg_progressive = true

png_quantization = true

max_src_resolution = "32M"

max_src_pixels = 16384×16384

We can now start the imgproxy server by running the following command-line in your terminal:

sudo imgproxy -config /etc/imgproxy.conf

After this command is executed, you can access imgproxy by entering the IP address or domain name of your server in a browser or curl.

Step 4: Enable Imgproxy at Boot Time

Finally, for convenience purposes, we'll enable imgproxy to start automatically when the system boots up. This can be done using the systemctl command:

sudo systemctl enable imgproxy

With this command, imgproxy will be enabled and start automatically whenever the system boots up.

Conclusion

In this tutorial, we have successfully installed imgproxy on NixOS, configured it with the basic settings, and enabled it to start at boot time. We encourage you to configure other advanced settings to fit your needs as well.

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!

Alternatively, for the best virtual desktop, try Shells!