What is Declarative Configuration in NixOS? Understanding Declarative vs Imperative Approaches?
What is Declarative Configuration in NixOS? Understanding Declarative vs Imperative Approaches?

Member-only story

#NixOS of Beginner

What is Declarative Configuration in NixOS? Understanding Declarative vs Imperative Approaches?

Rajdeep Singh
The Linux
Published in
3 min readOct 1, 2024

NixOS is an open-source Linux distribution based on the Nix package manager. NixOS uses a declarative configuration system (approach) that allows reproducibility and portability.

In NixOS, you follow tutorials on YouTube and read blogs; you know nixos uses a declarative configuration system to configure NixOS, such as installing and managing packages and services.

To install the Package, add and remove the services you need to mention in your nixos configuration.nix file and rebuild your nixos.

In the Linux distro world, there are two types of distro:

  1. Declarative Approach
  2. Imperative Approach

The Imperative type is the most common distro in linux ecosystem.

Declarative Approach

In the declarative approach, we use a file (such as a YAML, JSON, and Nix) to describe the configuration for hardware and software components such as systems, networking, users, services (like with systems), and more.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

The Linux
The Linux
Rajdeep Singh
Rajdeep Singh

Written by Rajdeep Singh

Follow me if you learn more about JavaScript | TypeScript | React.js | Next.js | Linux | NixOS | Frontend Developer | https://linktr.ee/officialrajdeepsingh

No responses yet

What are your thoughts?