Beginner questions regarding NixOS workflow and package issues

Hello everyone,

I’m a complete NixOS beginner, I installed it just a few hours ago. So far, I’m very happy with how smooth the installation process was. I’ve managed to get of my apps working and I am already productive. However, I encountered a number of small issues and would appreciate any advice

Issue 1: App Installation Workflow

Currently, my workflow for installing software is:

  1. Visit NixOS Search to find the correct package name.
  2. Add the package to my configuration.nix in either environment.systemPackages or users.users.<username>.packages.
  3. Run nixos-rebuild switch --use-remote-sudo.

Questions:

  1. Is this the right/best/standard workflow for installing software in NixOS?
  2. The documentation on search.nixos.org only suggests adding apps to environment.systemPackages = [ app-name ];, but shouldn’t I use users.users.<username>.packages for most user-specific packages instead?

Issue 2: Bash vs Sh

Some of my project build scripts failed initially because they require bash instead of sh. I fixed the issue by adding the following to my configuration.nix:

system.activationScripts.binbash = {
  deps = [ "binsh" ];
  text = ''
       ln -s /bin/sh /bin/bash
  '';
};

This solves the problem, but now I get an error every time I run nixos-rebuild switch --use-remote-sudo (l guess because the symlink already exists). Should it not be the case that the result of rebuilduing the system does not depend on the current state?

Issue 3: Missing Icons and some undefined Packages

Some apps I installed are missing icons. I tried reinstalling adwaita-icon-theme, but the package was not found. I got this error: error: undefined variable 'adwaita-icon-theme'. Similarly, some package names from NixOS search don’t seem to match. For instance, I could only install gnome-tweaks by using gnome3.gnome-tweaks.

Many thanks!

Prefer the option search first, which usually has some .enable option if an option exists.

1 Like

Thanks for your reply!

Prefer the option search first, which usually has some .enable option if an option exists.

Sorry, I am not sure I understand. Do you mean I should use first search in https://search.nixos.org/options to see if there is an option instead of installing something I find in https://search.nixos.org/packages, like the

# Install firefox.
  programs.firefox.enable = true;

part in my configuration?

Exactly!

When you add a package, you just “install” a binary.

When you use the option (often called <package>.enable), then it installs the binary as well as all the configuration, permissions & services that are required to make the program run successfully.

Often, using the options allows you to declaratively control how the program is configured (although you could technically do that with regular .dotfiles for most cases)