Getting Home Manager Working

I am trying to get home manager working as a module. I don’t get any errors in the build but I can’t seem to even get a basic shell alias to work.

configuration.nix

{ config, pkgs, ... }:

let
  home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-25.05.tar.gz";
  unstableTarball = fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz";
  unstable = import unstableTarball {
    config = config.nixpkgs.config;
  };

in

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
      (import "${home-manager}/nixos")
    ];
  
  home-manager.useUserPackages = true;
  home-manager.useGlobalPkgs = true;
  home-manager.backupFileExtension = "backup";
  home-manager.users.szemlicka = import ./home.nix;

home.nix

{ config, pkgs, ... }:

{
  home.username = "szemlicka";
  home.homeDirectory = "/home/szemlicka";
  home.stateVersion = "25.05";

  programs.bash = {
    enable = true;
    shellAliases = {
      btw = "echo working";
    };
  };
}

This all rebuilds without error and I’m confirming my shell is using bash with:

echo $SHELL
/run/current-system/sw/bin/bash

But for some reason I get:

btw
I: command not found

I suspect I’m missing something obvious. Can someone help point out what I’m missing?

Is there something strange in the bashaliases file? Did the h-m deployment actually work? (You can also check the systemd service for that.)

You’re on to something there since it says the home manager service doesn’t exist. I’m going to take a step back here and see if I can get the service going

I re-ran the install and rebooted and everything seems to be working now. Thanks a bunch.

There isn’t an installation when using hm as a nixos module. So if you’re using standalone hm, remove it from the nixos config - or vice versa.

Thank you for the follow-up. I had my terminology incorrect. I meant that I ran the nix-channel –add and the nix-channel –update.

For some reason the either the first add didn’t take or I incorrectly remembered doing it…or something else. Regardless, doing this add and update solved the problem.