using NIX - the package manager on Arch Linux or Gopi OS

S
SUVANKAR SARKAR
6 min read108 views
using NIX - the package manager on Arch Linux or Gopi OS

TL;DR

NIX will work smoothly using the `nix profile` including GUI applications

Using NIX - The Package Manager on Arch Linux or Gopi OS

TL;DR

NIX will work smoothly using the nix profile including GUI applications

Simple Idea of NIX - The Package Manager & How To Use

Use Case

Command

Persistence

Scope

Personal, persistent install

nix profile add

Yes

User Profile/Desktop Menu

Quick, temporary usage

nix shell

No

Current Terminal Session

System-wide config

home-manager switch

Yes

System/User-wide Declarative

On a Fresh Install of GOPIOS

sudo systemctl enable nix-daemon
sudo systemctl start nix-daemon
sudo chmod -R 0755 /nix
sudo chown -R $USER:$USER /nix
nix-channel --add https://nixos.org/channels/nixos-25.11 nixos
echo "experimental-features = nix-command flakes" | sudo tee -a /etc/nix/nix.conf
nix profile add nixpkgs#chromium
nix profile add github:NixOS/nixpkgs/nixpkgs-unstable#atop
nix search nixpkgs ollama
nix profile remove chromium
nix-collect-garbage

nix profile add nixpkgs#gimp - will work smoothly, but nix profile add nixpkgs#google-chrome may have issues.

Useful Links & Commands

nix-channel --list

nix-channel --add https://nixos.org/channels/channel-name nixos

Common Profile Commands

nix profile list
nix profile add nixpkgs#chromium
nix profile add nixpkgs#python39
nix profile add nixpkgs#python311
nix profile upgrade --all
nix profile upgrade chromium
nix profile list
nix profile remove nixpkgs#chromium
nix-collect-garbage

To Make GUI App Icon Available

export XDG_DATA_DIRS="$HOME/.nix-profile/share:${XDG_DATA_DIRS}"
sudo update-desktop-database ~/.nix-profile/share/applications
find ${XDG_CACHE_HOME:-$HOME/.cache}/**/qmlcache -type f -delete

🏠 What Home Manager Is

Home Manager is a tool in the Nix ecosystem that lets you manage your user-level configuration declaratively—things like shell settings, dotfiles, graphical apps, services, fonts, and more—all through Nix.

Home Manager (HM):

Uses Nix to declare and reproduce your user environment.

Works on NixOS, macOS, and other Linux distros (via "standalone mode").

Manages:

Dotfiles (.zshrc, .bashrc, .gitconfig, etc.)

CLI programs (zsh, fish, neovim, git, tmux…)

GUI apps (Firefox, Alacritty, Kitty…)

User services (systemd user units)

Environment variables

Packages (per-user installation)

🚀 Installing Home Manager

Option A: On NixOS (recommended)

Add Home Manager as a NixOS module:

/etc/nixos/configuration.nix:

{ config, pkgs, ... }: {
  imports = [];

  home-manager.users.yourusername = { pkgs, ... }: {
    home.stateVersion = "24.05"; # adjust to your HM version

    programs.zsh.enable = true;
    home.packages = [ pkgs.htop pkgs.neovim ];
  };
}

Then:

sudo nixos-rebuild switch

Option B: On macOS or non-NixOS Linux

Standalone installation:

nix-shell -p nixFlakes --run "true" # optional
nix run home-manager/master -- init --switch

This creates: ~/.config/home-manager/home.nix

📝 Example home.nix (Simple and Useful)

{ config, pkgs, ... }: {
  home.username = "alice";
  home.homeDirectory = "/home/alice";
  home.stateVersion = "24.05";

  programs.zsh = {
    enable = true;
    plugins = [
      { name = "zsh-autosuggestions"; src = pkgs.zsh-autosuggestions; }
      { name = "zsh-syntax-highlighting"; src = pkgs.zsh-syntax-highlighting; }
    ];
    shellAliases = {
      ll = "ls -l";
      gs = "git status";
    };
  };

  programs.git = {
    enable = true;
    userName = "Alice Example";
    userEmail = "[email protected]";
  };

  home.packages = with pkgs; [
    neovim
    htop
    ripgrep
    fd
  ];
}

Apply the config:

home-manager switch

🧩 How Home Manager Works

It generates symlinks in your home directory pointing to the Nix store.

All changes are atomic and versioned.

You can roll back configurations via:

home-manager rollback

Per-user packages go into: ~/.nix-profile

🔧 Using Flakes with Home Manager (Modern Setup)

flake.nix:

{
  description = "Home Manager config";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
    home-manager.url = "github:nix-community/home-manager";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = { self, nixpkgs, home-manager, ... }: {
    homeConfigurations.alice = home-manager.lib.homeManagerConfiguration {
      pkgs = nixpkgs.legacyPackages.x86_64-linux;
      modules = [ ./home.nix ];
    };
  };
}

Apply:

home-manager switch --flake .#alice

❓ Want Help Creating a Config?

If you want, I can help you:

Generate a full starter Home Manager config

Convert your dotfiles to Home Manager

Set up Home Manager with flakes

Use Home Manager on NixOS vs non-NixOS

Add specific programs (i3, Hyprland, tmux, neovim, etc.)

Home-manager without flake is recommended for simplicity.

✅ Is Home Manager Without Flakes Recommended?

Short answer: Yes, Home Manager without flakes is still supported and stable, and many users run it this way—but flakes are now generally recommended for new setups because they give better reproducibility and consistency.

👍 Pros of Traditional (Non-Flake) Home Manager

Simpler for beginners.

No flake features required.

Works the same on all systems (NixOS, macOS, Linux).

No need to learn the flake.lock mechanism yet.

👎 Cons

Harder to pin Nixpkgs and Home Manager versions.

Less reproducible.

Most modern guides use flakes, so examples need adapting.

As a result, many people see non-flake HM as fine but legacy-ish.

📘 Example Non-Flake Home Manager Setup

~/.config/home-manager/home.nix

{ config, pkgs, ... }: {
  home.username = "alice";
  home.homeDirectory = "/home/alice";
  home.stateVersion = "24.05";

  programs.zsh.enable = true;

  home.packages = [ pkgs.htop pkgs.neovim ];
}

Apply:

home-manager switch

💡 Recommendation (Practical)

If you're starting from scratch → Use flakes.

If you already have a working non-flake setup → No need to migrate unless you want reproducibility or advanced features.

✅ Setting Up Home Manager with Flakes on GOPIOS (Arch-based)

1. Install Nix (with flakes enabled)

GOPIOS/Arch already has nix available.

Install Nix:

sudo pacman -S nix

Enable Nix daemon:

sudo systemctl enable --now nix-daemon.service

Enable flakes + nix-command globally:

Create: /etc/nix/nix.conf

Add:

experimental-features = nix-command flakes

Restart nix-daemon:

sudo systemctl restart nix-daemon.service

2. Install Home Manager (Flake Version)

Run:

nix run home-manager/master -- init --switch

This creates:

~/.config/home-manager/flake.nix
~/.config/home-manager/home.nix

Your home manager is now flake-based by default.

3. Edit Your Home Manager Flake

Open: ~/.config/home-manager/flake.nix

Minimal version:

{
  description = "My Home Manager config";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
    home-manager.url = "github:nix-community/home-manager";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";
  };

  outputs = { self, nixpkgs, home-manager, ... }:
    let
      system = "x86_64-linux";
    in {
      homeConfigurations.user = home-manager.lib.homeManagerConfiguration {
        inherit system;
        homeDirectory = "/home/user";
        username = "user";
        modules = [ ./home.nix ];
      };
    };
}

Replace:

user with your username

correct home path

4. Edit home.nix (Your Actual Config)

~/.config/home-manager/home.nix

Example minimal config:

{ config, pkgs, ... }: {
  home.stateVersion = "24.05";

  programs.zsh.enable = true;

  home.packages = with pkgs; [
    neovim
    htop
  ];
}

5. Apply Your Config

From the directory:

cd ~/.config/home-manager

Switch:

home-manager switch --flake .#user

(Replace user with your username.)

🎉 Done!

You now have:

✔ Home Manager

✔ Using flakes

✔ On GOPIOS/Arch

✔ With a clean, minimal, modern setup

Tags

Share:

Comments

Sign in to join the discussion.
Sign in
Sort:
Loading comments...