Bash shellAliases and syncthing service not working using home-manager (non-NixOS)

I’m using Home Manager on Kubuntu w/ Nix, and in general on the package management side it works really well! That said, I have a couple of issues:

  • Syncthing doesn’t get installed as a service
  • Bash gets installed and enabled but without shellAliases
  • Less critically (for now), sessionVariables also aren’t showing up for me

My home.nix:

{ config, pkgs, ... }:

  home.username = "x";
  home.homeDirectory = "/home/x";

  targets.genericLinux.enable = true;
  xdg.mime.enable = true;
  home.stateVersion = "23.05"; # Please read the comment before changing.

  home.packages = with pkgs; [

  home.sessionVariables = {
    EDITOR = "vim";
  programs.home-manager.enable = true;

  # Bash settings
  programs.bash = {
    enable = true;
    shellAliases = {
      ll = "ls -l";
      ".." = "cd ..";

  services.syncthing = {
    enable = true;
    tray.enable = true;

It feels like I’ve missed a step in setting up how home-manager interacts with my system, but looking back through the directions for setup, I can’t see what that would be. Would be grateful if anyone has any ideas!

You can try to either use packages = [ ... or service / program not both.

When I don’t include bash under packages, the settings to enable it don’t take effect. That led me to believe that maybe I needed to include syncthing under packages too for it to be available for services configuration. Sadly it doesn’t make a difference. Either way it doesn’t seem to get installed as a service.

Appendix A. Configuration Options says it is defined as a hm module. So you’ll have to dig the hm manual for info how to use these modules.

Point 2 in Home Manager Manual says you would need NixOS or Darwin for it to be used as a module.

1 Like

I use this on Ubuntu:

programs.bash = { 
     enable = true;
     historyIgnore = [ "ls" "cd" "exit" ];
     historyControl = [ "ignoredups" "ignorespace" ];
     bashrcExtra = ""; # run always, even in non-interactive
     initExtra = ". ${nnn-bash-integration}"; # run when initializing an interactive shell
     logoutExtra = ""; # run when logging out of an interactive shell
     profileExtra = ""; # run when initializing a login shell
     sessionVariables = {
    shellAliases = {
       # Shell basics
       ls="ls --color=auto";

      # more aliases

No need to list bash in the packages section, same for syncthing.

1 Like

It turns out there was an error somewhere in my setup, I wish I could be more specific but I’m not 100% sure where. I walked through the steps to do a fresh setup again, added the same pieces above, and it worked! @wamserma, I did end up stealing several pieces of your bash config since it was nicer than mine. @573, thanks for the code pointers. I’m still getting used to home manager, so looking over the code/configuration is actually really helpful for me.

Edit: I should also mention, you were both right. Absolutely no need to include bash and syncthing in my packages. I kept those out on the second round.

As a side note, it can happen that you need to add a package to packages even if you have defined it as a service.
This is because sometimes the package from the service isn’t configured in a way that you can interact with the package e.g. for debugging or because their might be a GUI.
I think I have only seen this for services however because they are meant to be run in the background.

1 Like