Guix and Nix Packages (Short Practical Guide)

If you want reproducible environments and safer upgrades, Guix and Nix are two of the strongest options.

  • Nix: package manager and ecosystem around /nix/store, including NixOS.
  • Guix: functional package manager with Guile Scheme, including GNU Guix System (historically called GuixSD).

Why engineers like them

  • Reproducible builds: same input gives same output.
  • Rollback support: easy return to previous generations.
  • Isolated dependencies: avoid “works on my machine” conflicts.
  • Declarative systems: your OS/packages live in versioned config files.

Nix in practice

Install a package temporarily:

nix shell nixpkgs#htop
htop

Build a package from nixpkgs without installing globally:

nix build nixpkgs#hello
./result/bin/hello

Minimal flake.nix for a dev shell:

{
  description = "simple dev shell";

  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

  outputs = { self, nixpkgs }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs { inherit system; };
    in {
      devShells.${system}.default = pkgs.mkShell {
        packages = with pkgs; [ gcc gnumake pkg-config ];
      };
    };
}

Enter shell:

nix develop

Guix in practice

Install a package for current user profile:

guix install hello
hello

Build package output path only:

guix build hello

Minimal Guix System idea (declarative OS config excerpt):

(use-modules (gnu))

(operating-system
  (host-name "lab-node")
  (timezone "Etc/UTC")
  (locale "en_US.utf8")
  (packages (append (list (specification->package "git")
                          (specification->package "vim"))
                    %base-packages)))

Reconfigure system:

sudo guix system reconfigure /etc/config.scm

OS-level model: NixOS vs Guix System

  • Both use declarative configuration and generation-based rollbacks.
  • NixOS config is typically in Nix language (configuration.nix or flakes).
  • Guix System config is in Scheme (config.scm).
  • Both can fully define services, users, packages, and boot behavior.

Quick advice

  • Start with package manager mode first (Nix or Guix on your current distro).
  • Move to NixOS/Guix System after you are comfortable with declarative workflows.
  • Keep configs in Git from day one.