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

S
SUVANKAR SARKAR
13 min read9 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

Simple idea of NIX - the package manager & How To

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

nix profile add nixpkgs#gimp

-will work smoothly, but nix profile add nixpkgs#google-chrome

nix-channel --list

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

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 0

nix profile remove nixpkgs#chromium

nix-collect-garbage

nix profile expunge-old-generations

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

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.

Below is a concise but complete overview to help you understand and use Home Manager.

🏠 What Home Manager Is

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/nixos>
];

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 = "alice@example.com";
};

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

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.

Below is a clear comparison so you can decide confidently.

Is Home Manager without flakes recommended?

It is supported, stable, and perfectly fine if you prefer traditional Nix.
Home Manager’s documentation continues to include a non-flake installation path.

However, the Nix ecosystem is increasingly centered around flakes, and most new examples, modules, and community configurations assume flakes.

So:

OK choice if you want simplicity or have older configs.

Best long-term choice: use flakes (especially for NixOS + Home Manager together).

🔍 Pros & Cons

👍 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.

If you want, I can show you:

a minimal flake version of your current non-flake config

how to convert a non-flake setup → flake setup

or help you decide based on your current Nix/NixOS layout.

Just tell me!

You said:

i am on gopios (arch based), give me simple step to setup home-manager using flake

ChatGPT said:

Below is the simple, clean, minimal way to install Home Manager with flakes on Arch-based GOPIOS.

No NixOS modules, no extra complexity — just what you need.

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...